SynEdit: Add check for nil / Improve comments

git-svn-id: trunk@63450 -
This commit is contained in:
martin 2020-06-27 19:24:01 +00:00
parent 8fb8e98b28
commit 9afc716aa9
2 changed files with 16 additions and 5 deletions

View File

@ -2692,8 +2692,14 @@ begin
// When fixed FCaret, FBlockSelection, FTrimmedLinesView can move here
FFoldedLinesView.UnLock; // after ScanRanges, but before UpdateCaret
// must be last => May call MoveCaretToVisibleArea, which must only happen
// after unfold
(* FFoldedLinesView.UnLock
Any unfold (caused by caret move) will be done (deferred) in UnLock.
UpdateCaret may call MoveCaretToVisibleArea (which depends on what is folded)
Therefore UnLock must be called before UpdateCaret
Caret.Unlock must be done before UpdateCaret, because it sends the events
to FFoldedLinesView which triggers any unfold.
*)
Dec(FPaintLock);
if (FPaintLock = 0) and HandleAllocated then begin

View File

@ -24,7 +24,6 @@ of this file under either the MPL or the GPL.
unit SynEditFoldedView;
{$mode objfpc}{$H+}
{$coperators on}
{$IFDEF CPUPOWERPC} {$INLINE OFF} {$ENDIF} (* Workaround for bug 12576 (fpc) see bugs.freepascal.org/view.php?id=12576 *)
{$IFOPT C+}
@ -57,7 +56,12 @@ uses
type
TFoldNodeClassification = (fncInvalid, fncHighlighter, fncHighlighterEx, fncBlockSelection);
TFoldNodeClassification = (
fncInvalid,
fncHighlighter, // Fold provided by HL
fncHighlighterEx, // Fold originally provided by HL, but no longer exists in HL (text edited)
fncBlockSelection
);
TFoldNodeClassifications = set of TFoldNodeClassification;
{ TSynTextFoldAVLNodeData }
@ -2968,7 +2972,8 @@ procedure TSynEditFoldProvider.SetLines(AValue: TSynEditStrings);
begin
if FLines = AValue then Exit;
FLines := AValue;
FNestedFoldsList.Lines := FLines;
if FNestedFoldsList <> nil then
FNestedFoldsList.Lines := FLines;
end;
constructor TSynEditFoldProvider.Create;