Re: [code] [Textadept] Strange color change of fold margin

From: Mitchell <m.att.foicica.com>
Date: Mon, 20 Aug 2018 21:07:02 -0400 (EDT)

Hi Lars,

On Mon, 20 Aug 2018, Lars wrote:

> Hi Mitch,
>
>
> Am 12/08/2018 um 22:11 schrieb Mitchell:
>> Hi,
>>
>> On Sat, 11 Aug 2018, Lars wrote:
>>
>>> Hi Mitch and folks,
>>>
>>> I have two more questions:
>>>
>>> In the lexer context.lua line 38 is the following code:
>>> lex:add_fold_point(lexer.OPERATOR, '{', '}')
>>> What use does it have? When I comment it, then I can still fold brackets
>>> (braces too): see A in the attached figure.
>>
>> That line supplies folding of '{' and '}', as you'd expect. When you
>> comment out that line in your lexer file, are you restarting Textadept? Are
>> you sure you're modifying the correct file? Remember that any lexers in
>> *~/.textadept/lexers/* override Textadept's default lexers.
>
> I can't help it, but it seems to me that the line is unnecessary really.
> I did a fresh and clean installation of TA. Then I renamed the lexer file
> context.lua in Textadept/lexers to context.lua.bak, after I copied it to
> ~/lexers. There I commented line 69
> lex:add_fold_point(lexer.OPERATOR, '{', '}').
>
> After restarting TA and loading a ConTeXt file (status bar verifies context
> lexer) brackets are still foldable. Even braces, which aren't defined in the
> context.lua lexer anyway. It just seems to me that brackets, same as braces,
> fold globally, which if true would make line 69 in lexer context.lua
> redundant. Just wanted to let you know, as I know that you like to keep TA
> minimal.

Okay, thanks for poking me again. You are correct. The reason is because the ConTeXt lexer also embeds Lua, which folds on '{' and '}'. If you comment out both `lex:add_fold_point()` and `lex:embed(luatex, ...)`, you will not be able to fold on '{' and '}'.

You could argue that Lua's '{' and '}' should be different from ConTeXt's, and that you should still not be able to fold, but that would end up causing more trouble than it's worth.

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 Mon 20 Aug 2018 - 21:07:02 EDT

This archive was generated by hypermail 2.2.0 : Tue 21 Aug 2018 - 06:27:32 EDT