[Geany] Code folding doesn't work right.

Jiří Techet techet at xxxxx
Wed Aug 4 13:09:06 UTC 2010


On Wed, Aug 4, 2010 at 12:32, Daniel Carrera <dcarrera at gmail.com> wrote:
> On Wed, Aug 4, 2010 at 11:28 AM, Lex Trotman <elextr at gmail.com> wrote:
>> Ok, thats because they are NEW fold points, the old ones you had
>> rolled up were removed when you turned the whole file into a string.
>>
>> New fold points are always open otherwise as you typed the program it
>> would fold up on you.
>
> I don't understand at all. What is a "new" fold point vs an "old" fold
> point? I'm talking about functions that have been in the file for more
> than a day. Isn't that "old" enough? Why does Geany keep unfolding
> everything? Are you saying that every single function in my program is
> a "new" fold point? How do I make them old?

I'm not very familiar with perl but I expect you can write something like this:

$foo = "abc
def
ghi"

which is a string containing line breaks after "c" and "f".The same is
possible with python's '''.

Then the new/old thing means this - when you type ", the rest of the
file becomes a string (well, until it finds the next ") - there is no
way for the lexer to know that you really don't want to create a
string containing the code you have in your file after the ". Folds
don't exist inside strings so the fold you have created (and all the
fold points) disappears.

Personally I have no idea how to solve this problem. One way would be
not to display the text after " as string until you type the second "
but I think many people would be dissatisfied with this behaivor too.
Anyway, the problem should be discussed at scintilla mailing list - I
have tested it with SciTE and the same problem exists there as well so
I seriously doubt it is geany-specific. Or is there some knob in
scintilla to make this optional?

>
>
>> This isn't a problem with other languages, except for Python triple
>> quotes, because AFAIK no other language embeds newlines in strings, so
>> the extent of an opened string is limited to one line and the fold
>> points don't disappear since they are on other lines.
>
>
> PHP does too, and Ruby as well, and JavaScript, and I suspect probably
> Lua. So that's at least six languages. It is news to me that you can't
> have a multi-line string in Java/C/C++. That sounds strange.

In C/C++ you can write either

a = "foo"
    "bar";

or

a = "foo\
bar";

In both cases the preprocessor just concatenates the parts of the
string. The "\" just extends the string by one line so there cannot
happen anything like what you experience.

Cheers,

Jiri



More information about the Users mailing list