[Geany] Code folding doesn't work right.

Lex Trotman elextr at xxxxx
Wed Aug 4 13:42:36 UTC 2010


On 4 August 2010 23:33, Daniel Carrera <dcarrera at gmail.com> wrote:
> Hi Lex,
>
> On Wed, Aug 4, 2010 at 3:11 PM, Lex Trotman <elextr at gmail.com> wrote:
>> let me try an example, of a simple piece of Perl, with the folds shown
>> as best I can in plain text
>>
>> +-  if( $a<10 ){
>> |        print $i
>> --  }
>>
>> +- sub aaa {
>> |      return 1
>> -- }
>>
>> Then you fold up the sub aaa.
>>
>> Now deciding to add some text to the print type a quote on that line,
>> the sub stays rolled up but notice that it changes colour to indicate
>> its part of the string and the fold indicators disappear, as they
>> should, it is parsed as part of a string.  So there is no fold point
>> here to store the information that this is folded.
>
> On my computer it doesn't stay rolled up. But no matter - we agree
> that in the end the sub is unfolded.
>
>
>> And folds in PHP and Ruby behave the same as Perl, they unfold, in
>> fact using the same scenario as above they unfold immediately you type
>> the opening quote, the others I don't know enough to test.
>
> So that's 4 to 6 languages that have this problem.
>
>> Geany doesn't actually control the parsing, its done by Scintilla the
>> editing component it uses.  So Geany doesn't actually know that there
>> is an unclosed string in the file, and so wouldn't be able to use this
>> approach as far as I can see.
>
> Not much chance of it getting fixed then?

Well, you should bring up the issue on the Scintilla mailing list, but
I wouldn't be too hopeful since technically the parser is doing the
right thing parsing everything as a string and so losing the folds.

Note that the same thing happens with multiline comments in C/C++,
when you open the comment everything after loses the fold points and
is unfolded. At least until a close comment is encountered.

Cheers
Lex

>
> Daniel.
> --
> Intolerant people should be shot.
> _______________________________________________
> Geany mailing list
> Geany at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>



More information about the Users mailing list