mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 11:49:27 +02:00
Fix for undo if chars are add in tab space
This commit is contained in:
parent
2045755945
commit
d0c33bfa5d
@ -3227,7 +3227,7 @@ end;
|
|||||||
|
|
||||||
function TCustomCodeEditor.InsertFrom(Editor: PCustomCodeEditor): Boolean;
|
function TCustomCodeEditor.InsertFrom(Editor: PCustomCodeEditor): Boolean;
|
||||||
var OK: boolean;
|
var OK: boolean;
|
||||||
CP,RX,RSX,LineDelta,LineCount: Sw_integer;
|
CP,CI,RX,RSX,LineDelta,LineCount: Sw_integer;
|
||||||
StartPos,DestPos,BPos,EPos: TPoint;
|
StartPos,DestPos,BPos,EPos: TPoint;
|
||||||
LineStartX,LineEndX: Sw_integer;
|
LineStartX,LineEndX: Sw_integer;
|
||||||
TabSize,CharIdxStart,CharIdxEnd: Sw_integer;
|
TabSize,CharIdxStart,CharIdxEnd: Sw_integer;
|
||||||
@ -3251,6 +3251,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if not (Clipboard=@Self) and IsFlagSet(efOverwriteBlocks) and InSelectionArea then
|
if not (Clipboard=@Self) and IsFlagSet(efOverwriteBlocks) and InSelectionArea then
|
||||||
DelSelect; {delete selection before paste}
|
DelSelect; {delete selection before paste}
|
||||||
|
CI:=LinePosToCharIdx(CurPos.Y,CurPos.X);
|
||||||
|
CurPos.X:=CharIdxToLinePos(CurPos.Y,CI); {tab space adjustment}
|
||||||
StartPos:=CurPos; DestPos:=CurPos;
|
StartPos:=CurPos; DestPos:=CurPos;
|
||||||
EPos:=CurPos;
|
EPos:=CurPos;
|
||||||
VerticalBlock:=Editor^.IsFlagSet(efVerticalBlocks);
|
VerticalBlock:=Editor^.IsFlagSet(efVerticalBlocks);
|
||||||
@ -3377,12 +3379,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCodeEditor.InsertText(const S: sw_astring): Boolean;
|
function TCustomCodeEditor.InsertText(const S: sw_astring): Boolean;
|
||||||
var I: sw_integer;
|
var I,CI: sw_integer;
|
||||||
OldPos: TPoint;
|
OldPos: TPoint;
|
||||||
HoldUndo : boolean;
|
HoldUndo : boolean;
|
||||||
WasAutoBrackets : boolean;
|
WasAutoBrackets : boolean;
|
||||||
begin
|
begin
|
||||||
Lock;
|
Lock;
|
||||||
|
CI:=LinePosToCharIdx(CurPos.Y,CurPos.X);
|
||||||
|
CurPos.X:=CharIdxToLinePos(CurPos.Y,CI); {tab space adjustment}
|
||||||
OldPos:=CurPos;
|
OldPos:=CurPos;
|
||||||
HoldUndo:=GetStoreUndo;
|
HoldUndo:=GetStoreUndo;
|
||||||
WasAutoBrackets:=GetAutoBrackets;
|
WasAutoBrackets:=GetAutoBrackets;
|
||||||
@ -6150,6 +6154,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
SP.X:=CharIdxToLinePos(CurPos.Y,CI); {actual changes are going to be here (tab space adjustment)}
|
||||||
if (CI>0) and (S[CI]=TAB) and not IsFlagSet(efUseTabCharacters) then
|
if (CI>0) and (S[CI]=TAB) and not IsFlagSet(efUseTabCharacters) then
|
||||||
begin
|
begin
|
||||||
if CI=1 then
|
if CI=1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user