SynEdit: Keep Caret.y (and selection) at 1, even for lines.count = 0

git-svn-id: trunk@61680 -
This commit is contained in:
martin 2019-08-10 21:54:59 +00:00
parent 4c48234762
commit cc0a2ae11b
2 changed files with 3 additions and 3 deletions

View File

@ -2485,8 +2485,8 @@ begin
EnsureCursorPosVisible; // TODO: This may call SetTopLine, change order
// This does Paintlock, should be before final decrease
// Must be after EnsureCursorPosVisible (as it does MoveCaretToVisibleArea)
if FCaret.LinePos > FLines.Count then
FCaret.LinePos := FLines.Count;
if FCaret.LinePos > Max(FLines.Count, 1) then
FCaret.LinePos := Max(FLines.Count, 1);
if sfCaretChanged in fStateFlags then
UpdateCaret;
//if sfScrollbarChanged in fStateFlags then

View File

@ -2280,7 +2280,7 @@ begin
if FEnabled then begin
FStickyAutoExtend := False;
Value.y := MinMax(Value.y, 1, fLines.Count);
Value.y := MinMax(Value.y, 1, Max(fLines.Count, 1));
// ensure folded block at bottom line is in selection
if (ActiveSelectionMode = smLine) and (FFoldedView <> nil) and