mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 12:12:47 +02:00
SynEdit: fix tab key for persistent Block/Selection. Issue #0036917
git-svn-id: trunk@63014 -
This commit is contained in:
parent
11e9158faa
commit
1bbeacb3dc
@ -8561,7 +8561,8 @@ begin
|
||||
try
|
||||
i := 0;
|
||||
OldCaretX := CaretX;
|
||||
SelText := '';
|
||||
if SelAvail and (not FBlockSelection.Persistent) and (eoOverwriteBlock in fOptions2) then
|
||||
SelText := '';
|
||||
// With a multi-line block the caret may have advanced, avoid negative spaces
|
||||
if CaretX > OldCaretX then
|
||||
OldCaretX := CaretX;
|
||||
@ -8593,13 +8594,15 @@ begin
|
||||
// i now contains the needed spaces
|
||||
Spaces := CreateTabsAndSpaces(CaretX,i,TabWidth,
|
||||
not (eoTabsToSpaces in Options));
|
||||
//debugln('TCustomSynEdit.DoTabKey Spaces="',DbgStr(Spaces),'" TabChar=',DbgStr(TabChar));
|
||||
OldCaretX := CaretX;
|
||||
//debugln('TCustomSynEdit.DoTabKey Before SetSelText Line="',DbgStr(GetLineText),'"');
|
||||
SetSelTextExternal(Spaces);
|
||||
//debugln('TCustomSynEdit.DoTabKey After SetSelText Line="',DbgStr(GetLineText),'"');
|
||||
CaretX := OldCaretX + i;
|
||||
//debugln('TCustomSynEdit.DoTabKey StartOfBlock=',dbgs(StartOfBlock),' fBlockEnd=',dbgs(fBlockEnd),' Spaces="',Spaces,'"');
|
||||
|
||||
if SelAvail and (not FBlockSelection.Persistent) and (eoOverwriteBlock in fOptions2) then begin
|
||||
SetSelTextExternal(Spaces);
|
||||
end
|
||||
else begin
|
||||
FCaret.IncAutoMoveOnEdit;
|
||||
FTheLinesView.EditInsert(FCaret.BytePos, FCaret.LinePos, Spaces);
|
||||
FCaret.DecAutoMoveOnEdit;
|
||||
end;
|
||||
finally
|
||||
InternalEndUndoBlock;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user