Sync the fold_changed() implementation with SciTE
SciTE added the SCI_GETALLLINESVISIBLE check in revision 8dc4127cc8d76ecdf988928ac34e79955c09bda4: "Minimize cost of processing fold level changes to ensure visibility for the common case where the whole document is already visible." When nothing is folded, this improves the performance considerably which is visible e.g. when pasting larger amounts of text. Closes #507.
This commit is contained in:
parent
ccec1fe29a
commit
7006bdfd8c
@ -884,6 +884,7 @@ static void fold_changed(ScintillaObject *sci, gint line, gint levelNow, gint le
|
||||
{
|
||||
/* Adding a fold point */
|
||||
SSM(sci, SCI_SETFOLDEXPANDED, line, 1);
|
||||
if (!SSM(sci, SCI_GETALLLINESVISIBLE, 0, 0))
|
||||
expand(sci, &line, TRUE, FALSE, 0, levelPrev);
|
||||
}
|
||||
}
|
||||
@ -893,12 +894,14 @@ static void fold_changed(ScintillaObject *sci, gint line, gint levelNow, gint le
|
||||
{ /* Removing the fold from one that has been contracted so should expand
|
||||
* otherwise lines are left invisible with no way to make them visible */
|
||||
SSM(sci, SCI_SETFOLDEXPANDED, line, 1);
|
||||
if (!SSM(sci, SCI_GETALLLINESVISIBLE, 0, 0))
|
||||
expand(sci, &line, TRUE, FALSE, 0, levelPrev);
|
||||
}
|
||||
}
|
||||
if (! (levelNow & SC_FOLDLEVELWHITEFLAG) &&
|
||||
((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK)))
|
||||
{
|
||||
if (!SSM(sci, SCI_GETALLLINESVISIBLE, 0, 0)) {
|
||||
/* See if should still be hidden */
|
||||
gint parentLine = sci_get_fold_parent(sci, line);
|
||||
if (parentLine < 0)
|
||||
@ -911,6 +914,7 @@ static void fold_changed(ScintillaObject *sci, gint line, gint levelNow, gint le
|
||||
SSM(sci, SCI_SHOWLINES, line, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user