mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 12:36:26 +02:00
SynEdit: Tests for group undo for smart-unindent
git-svn-id: trunk@22582 -
This commit is contained in:
parent
e706efaedb
commit
88407a2f4b
@ -139,6 +139,9 @@ begin
|
|||||||
|
|
||||||
PopPushBaseName(Name + '(group-undo)');
|
PopPushBaseName(Name + '(group-undo)');
|
||||||
SetLines(Text);
|
SetLines(Text);
|
||||||
|
if (SelX >= 0) then
|
||||||
|
SetCaretAndSel(SelX, SelY, X, Y)
|
||||||
|
else
|
||||||
SetCaret(X, Y);
|
SetCaret(X, Y);
|
||||||
SynEdit.Options := SynEdit.Options + [eoGroupUndo];
|
SynEdit.Options := SynEdit.Options + [eoGroupUndo];
|
||||||
for i := 0 to length(data) div 4 - 1 do begin
|
for i := 0 to length(data) div 4 - 1 do begin
|
||||||
@ -515,7 +518,7 @@ procedure TTestSynBeautifier.DefaultUnIndent;
|
|||||||
Result := LinesToText(LinesReplace(TestText, rpl))
|
Result := LinesToText(LinesReplace(TestText, rpl))
|
||||||
end;
|
end;
|
||||||
begin
|
begin
|
||||||
SkipGroupUndo := True; // Todo
|
SkipGroupUndo := False;
|
||||||
ReCreateEdit;
|
ReCreateEdit;
|
||||||
SynEdit.TabWidth := 4;
|
SynEdit.TabWidth := 4;
|
||||||
SynEdit.TrimSpaceType := settMoveCaret;
|
SynEdit.TrimSpaceType := settMoveCaret;
|
||||||
@ -560,6 +563,7 @@ begin
|
|||||||
VK_BACK, 1,10, ExpText([ 10, 'z'])
|
VK_BACK, 1,10, ExpText([ 10, 'z'])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
SkipGroupUndo := True; // The first VK_BACK is deletet, not unindent, therefore it's 2 different undo
|
||||||
SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces];
|
SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces];
|
||||||
TestRedoUndo('only indent, no text', TestText, 8,3, [
|
TestRedoUndo('only indent, no text', TestText, 8,3, [
|
||||||
VK_BACK, 7,3, ExpText([ 3, ' ']),
|
VK_BACK, 7,3, ExpText([ 3, ' ']),
|
||||||
@ -576,6 +580,7 @@ begin
|
|||||||
VK_BACK, 1,3, ExpText([ 3, ''])
|
VK_BACK, 1,3, ExpText([ 3, ''])
|
||||||
]);
|
]);
|
||||||
SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces];
|
SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces];
|
||||||
|
SkipGroupUndo := False;
|
||||||
|
|
||||||
TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 4,2, ExpText([ 2, ' b']) ], 4,2);
|
TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 4,2, ExpText([ 2, ' b']) ], 4,2);
|
||||||
TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 1,2, ExpText([ 2, 'b']) ], 1,2);
|
TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 1,2, ExpText([ 2, 'b']) ], 1,2);
|
||||||
|
Loading…
Reference in New Issue
Block a user