From 8b3cf804747bcc0d0bd6b8ef08bc7bf0169263d1 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 25 Jan 2012 16:20:44 +0000 Subject: [PATCH] SynEdit: Fix invalidation, when selecting bottom to top git-svn-id: trunk@34936 - --- components/synedit/lazsyntextarea.pp | 2 +- components/synedit/synedit.pp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/synedit/lazsyntextarea.pp b/components/synedit/lazsyntextarea.pp index e8d8bba434..0bf1de47d0 100644 --- a/components/synedit/lazsyntextarea.pp +++ b/components/synedit/lazsyntextarea.pp @@ -396,7 +396,7 @@ begin - TopLine + 2) * LineHeight); {$IFDEF VerboseSynEditInvalidate} - DebugLn(['TCustomSynEdit.InvalidateGutterLines ',DbgSName(self), ' FirstLine=',FirstTextLine, ' LastLine=',LastTextLine, ' rect=',dbgs(rcInval)]); + DebugLn(['TCustomSynEdit.InvalidateTextLines ',DbgSName(self), ' FirstLine=',FirstTextLine, ' LastLine=',LastTextLine, ' rect=',dbgs(rcInval)]); {$ENDIF} if (rcInval.Top < rcInval.Bottom) and (rcInval.Left < rcInval.Right) then InvalidateRect(Handle, @rcInval, FALSE); diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 2287e10591..fbd005a327 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -2478,6 +2478,9 @@ begin if FOldTopView <> TopView then FFoldedLinesView.TopLine := FOldTopView; + if (LastLine <> -1) and (LastLine < FirstLine) then + SwapInt(FirstLine, LastLine); + FPaintArea.InvalidateGutterLines(FirstLine-1, LastLine-1); FFoldedLinesView.TopLine := TopFoldLine; @@ -2495,7 +2498,7 @@ begin if sfPainting in fStateFlags then exit; if Visible and HandleAllocated then begin {$IFDEF VerboseSynEditInvalidate} - DebugLnEnter(['TCustomSynEdit.InvalidateTektLines ',DbgSName(self), ' FirstLine=',FirstLine, ' LastLine=',LastLine]); + DebugLnEnter(['TCustomSynEdit.InvalidateTextLines ',DbgSName(self), ' FirstLine=',FirstLine, ' LastLine=',LastLine]); {$ENDIF} if (FirstLine = -1) and (LastLine = -1) then begin FPaintArea.InvalidateTextLines(-1, -1); @@ -2505,6 +2508,9 @@ begin if FOldTopView <> TopView then FFoldedLinesView.TopLine := FOldTopView; + if (LastLine <> -1) and (LastLine < FirstLine) then + SwapInt(FirstLine, LastLine); + FPaintArea.InvalidateTextLines(FirstLine-1, LastLine-1); FFoldedLinesView.TopLine := TopFoldLine;