Re: [code] [scintillua] folder improvements

From: Tymur Gubayev <tymur.gubayev.att.gmail.com>
Date: Wed, 14 Mar 2012 21:50:45 +0100

So, after some hours of debugging the folder (and that's not that
easy...) I have 2 questions:

1. Why is on every char added/deleted the text is processed in 2
chunks: current and next line is the first chunk, and the whole
document after next line is 2nd chunk. I don't understand the purpose
of this 2nd chunk if nothing has been changed in folding of 1st one.

2. What is this code in LexLPeg.cxx, lines 495-497, supposed to do:
                                // Mask off the level number, leaving only the previous flags.
                                int flagsNext = styler.LevelAt(maxline + 1) & ~SC_FOLDLEVELNUMBERMASK;
                                styler.SetLevel(maxline + 1, maxlevel | flagsNext);
(I understand what it does: takes the foldlevel of last line folded,
and sets it as foldlevel of the next line, preserving flags)
It's the code that unfortunally break my algorithm (I think I can do a
workaround, but it looks more and more ugly, as I will need to go far
outside the text passed to fold function).

On 14 March 2012 19:50, Tymur Gubayev <tymur.gubayev.att.gmail.com> wrote:
> Hi Mitchell,
>
> I'm using in lua.lua:
>
> M._foldsymbols = {
>  [l.KEYWORD] = {
>    ['if'] = 1, ['do'] = 1, ['function'] = 1, ['end'] = -1, ['repeat'] = 1,
>    ['until'] = -1, ['else'] = 0, ['elseif'] = 0,
>  },
> -- rest unchanged
> }
>
> Actually, it would be much better if number 1 would be done by
> scintilla, it's rather dirty workaround as of now. But then we will
> probably need another workaround for 1+ :).
>
> I also found a bug in my code due to how the fold function is called
> (You notice it by editing lines with "middle"-keywords in them, but
> refreshing syntax highlighting fixes it -- a workaround until i'm able
> to fix the algorithm.)
>
> Wbr,
>  Tymur
>
> On 14 March 2012 16:52, Mitchell <m.att.foicica.com> wrote:
>> Hi Tymur,
>>
>>
>> On Tue, 13 Mar 2012, Tymur Gubayev wrote:
>>
>>> Hi list,
>>>
>>> I just got some long time wanted (by me) feature of folding,
>>> consisting of 2 things:
>>> 1. The simple one: don't hide the very last line of fold block (I
>>> like to see the 'end's)
>>> 2. The one i really wanted: "fold in the middle", i.e. on "else",
>>> "elseif", etc.
>>>
>>> [snip]
>>>
>>>
>>> See possible realisation attached in lexer.patch.
>>> (You need to add keywords to "M._foldsymbols" manually)
>>
>>
>> This is a very clever trick :) Can you give example M._foldsymbols keywords?
>>
>> 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.
>>

-- 
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 Wed 14 Mar 2012 - 16:50:45 EDT

This archive was generated by hypermail 2.2.0 : Thu 15 Mar 2012 - 06:32:42 EDT