SynEdit: Fixed inconsistency between SetCaretY/X (only one cord) and SetCaretXY (both). The latter would always clear selection if set (even if unchanged), the former only on change. The former was changed. Issue #20209

git-svn-id: trunk@35464 -
This commit is contained in:
martin 2012-02-18 20:42:51 +00:00
parent aee57b0b70
commit f0452c78ad

View File

@ -789,7 +789,7 @@ type
function PrevWordLogicalPos(ABoundary: TLazSynWordBoundary = swbWordBegin): TPoint; function PrevWordLogicalPos(ABoundary: TLazSynWordBoundary = swbWordBegin): TPoint;
procedure RecalcCharExtent; procedure RecalcCharExtent;
procedure RedoItem(Item: TSynEditUndoItem); procedure RedoItem(Item: TSynEditUndoItem);
procedure SetCaretXY(Value: TPoint); virtual; procedure SetCaretXY(Value: TPoint);
procedure CaretChanged(Sender: TObject); procedure CaretChanged(Sender: TObject);
procedure SetName(const Value: TComponentName); override; procedure SetName(const Value: TComponentName); override;
procedure SetReadOnly(Value: boolean); virtual; procedure SetReadOnly(Value: boolean); virtual;
@ -3906,11 +3906,13 @@ end;
procedure TCustomSynEdit.SetCaretX(const Value: Integer); procedure TCustomSynEdit.SetCaretX(const Value: Integer);
begin begin
FCaret.ChangeOnTouch; // setting the caret always clears selection (even setting to current pos / no change)
FCaret.CharPos := Value; FCaret.CharPos := Value;
end; end;
procedure TCustomSynEdit.SetCaretY(const Value: Integer); procedure TCustomSynEdit.SetCaretY(const Value: Integer);
begin begin
FCaret.ChangeOnTouch; // setting the caret always clears selection (even setting to current pos / no change)
FCaret.LinePos := Value; FCaret.LinePos := Value;
end; end;
@ -3932,7 +3934,7 @@ end;
procedure TCustomSynEdit.SetCaretXY(Value: TPoint); procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
// physical position (screen) // physical position (screen)
begin begin
FCaret.ChangeOnTouch; FCaret.ChangeOnTouch; // setting the caret always clears selection (even setting to current pos / no change)
FCaret.LineCharPos:= Value; FCaret.LineCharPos:= Value;
end; end;