[feedback] folding in scintilla
Nick Sabalausky
a at a.a
Tue Apr 13 11:34:00 PDT 2010
"maXmo" <nospam at nospam.org> wrote in message
news:hq1k6n$2omq$1 at digitalmars.com...
> Nick Sabalausky Wrote:
>
>> Ahh, I see. No, that's not what I was talking about. This is a mockup of
>> the
>> way I've been wanting it:
>>
>> http://www.semitwist.com/download/goodFolding.png
>>
>> Putting it on the line with the "{" seem ridiculous, ugly and just plain
>> sloppy to me. (IMO).
>>
> 1. How should it work for sun style?
> 2. How should it work for multiline function signature?
By "sun-style", I assume you mean like this:
foo {
}
right?
Well, the current folding rule scintilla uses is something like this:
- Folding starts at (but does not include) any "{" in the source.
What I have in mind is more like:
- Folding starts at (but does not include) the last non-whitespace character
just before any "{" in the source. (This would also make it work for a
language like Go^H^H Issue 9)
So, it would be like this mockup (top is sun-style, bottom is multi-line):
http://www.semitwist.com/download/goodFoldingMore.png
In any case, even if neither the opening nor closing curly brace is visible,
I think the horizontal rule is sufficient in indicating that a block of code
is hidden. But, if some people think that's too subtle (or to allow a
VS.NET-style "hover to show the folded code in a popup tooltip"), then it
could also do what Andrej suggested and place a specially-highlighted
"{...}" (actually including the three dots) at the end of the line just
before the horizontal rule.
To properly handle something like this:
void foo()
{
int x;
{
auto f = openFile();
scope(exit) closeFile(f);
bar(f);
}
baz();
}
I suppose you could modify the rule to something more like:
- Folding starts at (but does not include) the last non-whitespace character
just before any "{" in the source, as long as that character is a ")",
otherwise just fold at (but not including) the whitespace character
immediately before the "{" in question.
or
- Folding starts at (but does not include) the last non-whitespace character
just before any "{" in the source, unless that character is a semicolon or
another "{", in which case just fold at (but not including) the whitespace
character immediately before the "{" in question.
More information about the Digitalmars-d
mailing list