From 4687ef5cc02d13fcd7cd9634d69424588e277e16 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 19 Sep 2011 18:42:31 +0000 Subject: [PATCH] SynEdit: fixed crash, with ecDeleteLine on last line. issue #0020299 git-svn-id: trunk@32424 - --- components/synedit/synedit.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 9efc0f6ea7..c228efe3b1 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -1941,6 +1941,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 sfCaretChanged in fStateFlags then UpdateCaret; //if sfScrollbarChanged in fStateFlags then @@ -4929,6 +4931,7 @@ begin ScanRanges; InvalidateLines(AIndex + 1, -1); InvalidateGutterLines(AIndex + 1, -1); + if FCaret.LinePos > FLines.Count then FCaret.LinePos := FLines.Count; end; if TopLine > AIndex + 1 then TopLine := TopLine + ACount // will call UpdateScrollBars