SynEdit: fixed some cases where none moving cursor key (e.g. end-key at line end) would not unset the selection. Happened if caret was not moved to set selection (copy word on copy none)

git-svn-id: trunk@33310 -
This commit is contained in:
martin 2011-11-04 19:58:17 +00:00
parent 15e82e2123
commit 328267f217
2 changed files with 17 additions and 0 deletions

View File

@ -1907,6 +1907,7 @@ begin
FMarkupManager.IncPaintLock;
FFoldedLinesView.Lock; //DecPaintLock triggers ScanFrom, and folds must wait
FTrimmedLinesView.Lock; // Lock before caret
FBlockSelection.Lock;
FCaret.Lock;
FScreenCaret.Lock;
end;
@ -1928,6 +1929,7 @@ begin
FChangedLinesEnd:=0;
end;
FCaret.Unlock; // Maybe after FFoldedLinesView
FBlockSelection.Unlock;
FTrimmedLinesView.UnLock; // Must be unlocked after caret // May Change lines
FFoldedLinesView.UnLock; // after ScanFrom, but before UpdateCaret
FMarkupManager.DecPaintLock;

View File

@ -119,6 +119,8 @@ type
procedure DoCaretChanged(Sender: TObject);
procedure AdjustAfterTrimming; // TODO: Move into TrimView?
protected
procedure DoLock; override;
procedure DoUnlock; override;
Procedure LineChanged(Sender: TSynEditStrings; AIndex, ACount : Integer);
procedure DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBytePos, aCount,
aLineBrkCnt: Integer; aText: String);
@ -788,6 +790,18 @@ begin
// Todo: Call ChangeNotification
end;
procedure TSynEditSelection.DoLock;
begin
inherited DoLock;
FLastCarePos := Point(-1, -1);
end;
procedure TSynEditSelection.DoUnlock;
begin
inherited DoUnlock;
FLastCarePos := Point(-1, -1);
end;
function TSynEditSelection.GetSelText : string;
function CopyPadded(const S: string; Index, Count: integer): string;
@ -952,6 +966,7 @@ end;
procedure TSynEditSelection.DoCaretChanged(Sender: TObject);
begin
// FIgnoreNextCaretMove => caret skip selection
if FIgnoreNextCaretMove then begin
FIgnoreNextCaretMove := False;
FLastCarePos := Point(-1, -1);