Re: [code] How to make the folding markers larger?

From: Mitchell <m.att.foicica.com>
Date: Thu, 21 Feb 2019 22:41:23 -0500 (EST)

Hi David,

On Fri, 22 Feb 2019, David Tamar wrote:

> Hi everyone. I'm new to Textadept and I'm still learning how it works and configuring it for the last two weeks since I've found it.
>
> I'm trying to increase the size of the folding buttons which appear in the left margin, they're typically boxes containing +/-. The problem with them is that they're way too small for me, my screen is 12.5" with 176 DPI, I have to make them at least twice as large. I tried to search both the Textadept API documentation and the Scintilla documentation for clues but I couldn't find anything on that specifically, and Google wasn't friendly due to the terms describing it.

Try putting in your *~/.textadept/init.lua*:

   buffer.margin_width_n[2] = 24

The default is 12 pixels. You can experiment using the Lua command entry before committing to your *init.lua*.

> I'm also trying to find a way to make the default folding style appear as "[...]" at the end of the folding line (for any language), instead of having that horizontal line beneath it stretching over the whole line (I'm trying to remove that horizontal line as well).

There is no way to automatically do this. You'll have to first set:

   buffer.fold_display_text_style = buffer.FOLDDISPLAYTEXT_BOXED

This enables the ability to show some text at the end of a folded line. Then you'll want to listen for `events.MARGIN_CLICK` events:

   events.connect(events.MARGIN_CLICK, function(margin, position)
     if margin ~= 2 then return end -- only interested in fold margin
     local line = buffer:line_from_position(position)
     buffer:toggle_fold_show_text(line, '[...]')
   end)

You can use anything for the string. You can also tie the functionality to a key command or menu command. You may have to tweak the snippet, as I haven't tested it.

You can hide the fold line with:

   buffer.fold_flags = 0

(It's a bitmask value.)

I hope that helps.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 21 Feb 2019 - 22:41:23 EST

This archive was generated by hypermail 2.2.0 : Fri 22 Feb 2019 - 06:49:21 EST