Skip to content

Commit

Permalink
Add comment. Hope it makes some sense.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Jun 16, 2024
1 parent 439624b commit 670d078
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Components/ScintEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1825,8 +1825,22 @@ procedure TScintEdit.StyleNeeded(const EndPos: Integer);
var Section := TInnoSetupStyler.GetSectionFromLineState(FStyler.LineState);
if Section <> scNone then
Call(SCI_SETFOLDLEVEL, I, SC_FOLDLEVELBASE+1)
else
else begin
{ Everything outside a section should have the header flag, even if it's
just a blank line or a comment. Doing this doesn't cause many fold
markers: if two lines have the same level and header flag the first
line doesn't get a fold mark since there's nothing to expand.
Not doing this however is a problem: for example, if the first
line is empty and and the second line starts a section then those two
lines would logically considered to be in the same 'fold' and edits
on the first line would affect the section if collapsed.
Did notice an issue (Scintilla bug?): Add a section with some lines.
Collapse it. Break the section header for example by removing ']'.
Scintialla now auto expands the section and removes the fold mark.
Retype the ']'. Scintilla now displays the old fold mark to expand the
section but it's already expanded. }
Call(SCI_SETFOLDLEVEL, I, SC_FOLDLEVELBASE or SC_FOLDLEVELHEADERFLAG);
end;
end;

Result := LastLine;
Expand Down

0 comments on commit 670d078

Please sign in to comment.