This message describes 2 modifications to Scintilla and 2
modifications to SciTE to correct folding bugs. If the proposed fixes
work well, then other applications using Scintilla should copy the
SciTE changes.

   Referring to
https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1219354&group_id=2439

   After some more information, I was able to reproduce these.

> a) When i paste _whole line_ from clipboard, folded
> block expands with no reason

   I think this has a good obvious fix in Scintilla. When pasting, the
current implementation tries to ensure that the pasted text will be
visible by ensuring that the range from the inserted position for the
length of the insertion is visible (unfolded) but it does this before
inserting the text so affects other lines. The modification is to only
ensure that the position of the insertion is visible.

> b) When i mark the previous line (Shift+CursorUp) and
> Cut it (Ctrl+X), folded block stays contracted, but folding
> mark on the left is changed to "expanded"

   This is more complex and was exposed by a recent (January 2005)
change made in response to the "folding + undo = problem" thread. The
base problem is what to do with existing fold state when a line is
deleted. It makes sense to try to preserve as much fold state as
possible, particularly the contractions performed by the user.
However, inconsistencies, such as a contracted section with no fold
header have to be fixed up.

   The current code moves up all the fold state on later lines and
leaves the line being deleted alone. This will give the correct result
for the common case of pressing Delete at the end of the line but not
for selecting the whole line and pressing Delete. The incorrect state
should only be temporary as it will soon be fixed up when the lexer
and folder are run. However, before that happens some more code will
be run, including code (in SciTE) that watches for the insertion and
deletion of fold headers. If it sees a fold header has been removed
then any contraction will be expanded (may be unexpected but should be
safe) but if it sees a new fold header, it sets that line to expanded
but does not actually show the fold's lines leading to a '-' with
hidden text.

   To avoid the possibility of a '-' in the fold margin with hidden
child lines when a fold point disappears, SciTE now performs a full
expansion of that line.

   This has the unwanted side effect that the example in the fault
report will see unwanted expansion because of the transient removal of
the fold header flag on a line that should be a fold header. To avoid
this, when moving up later lines, Scintilla checks for a fold header
flag on the initial line and ors that flag onto the new state of that
line. If this is wrong then it should soon be fixed up by the
lexer+folder.

   Experimenting with the example revealed that it was possible to
create unreachable text with a line containing two start fold symbols:
{{
    body();
  }
}
   If the first line is contracted and then the first '{' is deleted,
then expanding the fold header will not display the last line. This is
fixed in SciTE by looking for the fold level of a line diminishing and
checking to see if it should now become visible (either it has no
header or its header is visible and expanded).

   The modifications are available from CVS and from
http://scintilla.sourceforge.net/scite.zip Source
http://scintilla.sourceforge.net/wscite.zip Windows executable

The CVS revisions are
scintilla/src/Editor.cxx 1.328
scintilla/src/CellBuffer.cxx 1.37
scite/src/SciTEBase.cxx 1.570,1.571

   Neil

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to