~ubuntu-branches/ubuntu/vivid/lazarus/vivid

« back to all changes in this revision

Viewing changes to components/synedit/test/testtrimspace.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Paul Gevers
  • Date: 2013-06-22 13:31:45 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130622133145-kf2awlf322usnrfv
Tags: 1.0.10+dfsg-1
[ Abou Al Montacir ]
* New upstream maintenance release offering many fixes improving the IDE and
  the LCL stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch#Fixes_for_1.0.10
* Use compiler configuration file to pass debian custom compiler flags.
* Recover FTBFS on arm machines fix, dropped unintentionally when upgrading
  to 1.0.8. QT4 based LCL WS could not use QTOPIA. (Closes: Bug#712834)
* Update copyright notice to highlight that upstream source where repacked.

[ Paul Gevers ]
* Update Standard to 3.9.4 (no changes needed)
* Remove obsolete DM-Upload-Allowed
* Update lintian overrides
* Add myself to uploaders
* Update Vsc-Browser URL to the browse interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
type
23
23
 
 
24
  TTestTrimUndoEntry = record
 
25
    Command:  TSynEditorCommand;
 
26
    CaretWas: TPoint;
 
27
    VTextWas: String;
 
28
  end;
 
29
 
24
30
  { TTestTrimSpace }
25
31
 
26
32
  TTestTrimSpace = class(TTestBase)
27
33
  private
28
34
    FTName: String;
29
35
    FUseEc: Boolean;
 
36
    FUndoList: Array of TTestTrimUndoEntry;
 
37
    FRedoList: Array of TTestTrimUndoEntry;
 
38
    FUndoIndex: Integer;
30
39
  protected
31
 
    procedure test_assert(ASubName: String; AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
40
    procedure test_assert(ASubName: String; AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1; AppendCr: Boolean = True);
 
41
    procedure test_assert(ASubName: String; AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1; AppendCr: Boolean = True);
 
42
    procedure test_add_undo(Cmd: TSynEditorCommand; IsRedo: Boolean = False);
 
43
 
32
44
    procedure test_start(AName, Txt: String);
 
45
    procedure test_start(AName: String; Txt: Array of String);
 
46
    procedure test_start(AName: String; Txt: Array of String; X, Y: Integer);
 
47
 
33
48
    Procedure test_cmd(ASubName: String; X, Y: Integer; Cmd: TSynEditorCommand; AChar: TUTF8Char;
34
49
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
50
    Procedure test_cmd(ASubName: String; Cmd: TSynEditorCommand;
 
51
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1;
 
52
                       SkipAddUndo: Boolean = False);
35
53
    Procedure test_caret(ASubName: String; X, Y: Integer;
36
54
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
37
 
    Procedure test_undo(ASubName: String;
38
 
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
39
 
    Procedure test_redo(ASubName: String;
40
 
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
55
 
 
56
    Procedure test_type  (ASubName: String; AText: String;
 
57
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
58
    Procedure test_type  (ASubName: String; AText: String; X, Y: Integer;
 
59
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
60
    Procedure test_bspace(ASubName: String;
 
61
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
62
    Procedure test_bspace(ASubName: String; X, Y: Integer;
 
63
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
64
    Procedure test_del   (ASubName: String;
 
65
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
66
    Procedure test_del   (ASubName: String; X, Y: Integer;
 
67
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
68
 
 
69
    Procedure test_undo(ASubName: String; SkipCaretTest: Boolean = False);
 
70
    Procedure test_redo(ASubName: String; SkipCaretTest: Boolean = False);
 
71
    Procedure test_undo_exp(ASubName: String;
 
72
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
73
    Procedure test_undo_exp(ASubName: String;
 
74
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
 
75
    Procedure test_redo_exp(ASubName: String;
 
76
                       AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
77
    Procedure test_redo_exp(ASubName: String;
 
78
                       AExp: Array of String; AExpX: Integer = -1; AExpY: Integer = -1);
41
79
    procedure SetUp; override;
 
80
    procedure TearDown; override;
42
81
  published
43
82
    procedure TrimUndoRedo;
44
83
    procedure TrimUndoRedoEc;
57
96
  FUseEc := False;
58
97
end;
59
98
 
60
 
procedure TTestTrimSpace.test_assert(ASubName: String; AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
61
 
begin
 
99
procedure TTestTrimSpace.TearDown;
 
100
begin
 
101
  SetLength(FUndoList, 0);
 
102
  inherited TearDown;
 
103
end;
 
104
 
 
105
procedure TTestTrimSpace.test_assert(ASubName: String; AExp: String = '';
 
106
  AExpX: Integer = -1; AExpY: Integer = -1; AppendCr: Boolean = True);
 
107
begin
 
108
  if AppendCr then AExp := AExp + cr;
62
109
  if AExp <> '' then
63
 
    AssertEquals(FTName+' ('+ASubName+') Text', DbgStr(AExp+cr), DbgStr(SynEdit.ViewedTextBuffer.Text));
 
110
    TestCompareString(FTName+' ('+ASubName+') Text', AExp, SynEdit.ViewedTextBuffer.Text);
64
111
  if AExpX > 0 then begin
65
112
    AssertEquals(FTName+' ('+ASubName+') Caret X', AExpX, SynEdit.CaretX);
66
113
    AssertEquals(FTName+' ('+ASubName+') Caret Y', AExpY, SynEdit.CaretY);
68
115
//debugln(['done ',ASubName]);
69
116
end;
70
117
 
 
118
procedure TTestTrimSpace.test_assert(ASubName: String; AExp: array of String; AExpX: Integer;
 
119
  AExpY: Integer; AppendCr: Boolean = True);
 
120
begin
 
121
  test_assert(ASubName, LinesToText(AExp), AExpX, AExpY, AppendCr);
 
122
end;
 
123
 
 
124
procedure TTestTrimSpace.test_add_undo(Cmd: TSynEditorCommand; IsRedo: Boolean);
 
125
begin
 
126
  if not IsRedo then begin
 
127
    inc(FUndoIndex);
 
128
    SetLength(FUndoList, FUndoIndex);
 
129
    FUndoList[FUndoIndex-1].Command := Cmd;
 
130
    FUndoList[FUndoIndex-1].CaretWas := SynEdit.CaretXY;
 
131
    FUndoList[FUndoIndex-1].VTextWas := SynEdit.ViewedTextBuffer.Text;
 
132
  end
 
133
  else begin
 
134
    SetLength(FRedoList, FUndoIndex);
 
135
    FRedoList[FUndoIndex-1].Command := Cmd;
 
136
    FRedoList[FUndoIndex-1].CaretWas := SynEdit.CaretXY;
 
137
    FRedoList[FUndoIndex-1].VTextWas := SynEdit.ViewedTextBuffer.Text;
 
138
  end;
 
139
end;
 
140
 
71
141
procedure TTestTrimSpace.test_start(AName, Txt: String);
72
142
begin
73
143
  FTName := AName;
74
144
  SynEdit.Text := Txt;
 
145
  SetLength(FUndoList, 0);
 
146
  FUndoIndex := 0;
75
147
//debugln(['----- START ',AName]);
76
148
end;
77
149
 
78
 
 
79
 
Procedure TTestTrimSpace.test_cmd(ASubName: String; X, Y: Integer; Cmd: TSynEditorCommand; AChar: TUTF8Char;
80
 
                   AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
81
 
begin
 
150
procedure TTestTrimSpace.test_start(AName: String; Txt: array of String);
 
151
begin
 
152
  test_start(AName, LinesToText(Txt));
 
153
end;
 
154
 
 
155
procedure TTestTrimSpace.test_start(AName: String; Txt: array of String; X, Y: Integer);
 
156
begin
 
157
  test_start(AName, LinesToText(Txt));
 
158
  SynEdit.CaretXY := Point(x, y);
 
159
end;
 
160
 
 
161
procedure TTestTrimSpace.test_cmd(ASubName: String; X, Y: Integer; Cmd: TSynEditorCommand;
 
162
  AChar: TUTF8Char; AExp: String; AExpX: Integer; AExpY: Integer);
 
163
begin
 
164
  test_add_undo(Cmd);
 
165
 
82
166
  SynEdit.CaretXY := Point(x, y);
83
167
  SynEdit.CommandProcessor(Cmd, AChar, nil);
84
 
  test_assert('cmd: '+ASubName, AExp, AExpX, AExpY);
85
 
end;
86
 
 
87
 
Procedure TTestTrimSpace.test_caret(ASubName: String; X, Y: Integer;
88
 
                   AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
168
 
 
169
  test_add_undo(Cmd, True);
 
170
  test_assert('cmd: '+ASubName, AExp, AExpX, AExpY);
 
171
end;
 
172
 
 
173
procedure TTestTrimSpace.test_cmd(ASubName: String; Cmd: TSynEditorCommand;
 
174
  AExp: array of String; AExpX: Integer; AExpY: Integer; SkipAddUndo: Boolean);
 
175
begin
 
176
  if not SkipAddUndo then
 
177
    test_add_undo(Cmd);
 
178
 
 
179
  SynEdit.CommandProcessor(Cmd, '', nil);
 
180
 
 
181
  if not SkipAddUndo then
 
182
    test_add_undo(Cmd, True);
 
183
  test_assert('cmd: '+ASubName, AExp, AExpX, AExpY);
 
184
end;
 
185
 
 
186
procedure TTestTrimSpace.test_caret(ASubName: String; X, Y: Integer; AExp: String;
 
187
  AExpX: Integer; AExpY: Integer);
89
188
begin
90
189
  SynEdit.CaretXY := Point(x, y);
91
190
  test_assert('caret: '+ASubName, AExp, AExpX, AExpY);
92
191
end;
93
192
 
94
 
Procedure TTestTrimSpace.test_undo(ASubName: String;
95
 
                   AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
193
procedure TTestTrimSpace.test_type(ASubName: String; AText: String; AExp: array of String;
 
194
  AExpX: Integer; AExpY: Integer);
 
195
begin
 
196
  test_add_undo(ecChar);
 
197
  SynEdit.TestTypeText(AText);
 
198
  test_add_undo(ecNone, True);
 
199
  test_assert('Typed: '+ASubName, AExp, AExpX, AExpY);
 
200
end;
 
201
 
 
202
procedure TTestTrimSpace.test_type(ASubName: String; AText: String; X, Y: Integer;
 
203
  AExp: array of String; AExpX: Integer; AExpY: Integer);
 
204
begin
 
205
  test_add_undo(ecChar);
 
206
  SynEdit.CaretXY := Point(x, y);
 
207
  SynEdit.TestTypeText(AText);
 
208
  test_add_undo(ecNone, True);
 
209
  test_assert('Typed: '+ASubName, AExp, AExpX, AExpY);
 
210
end;
 
211
 
 
212
procedure TTestTrimSpace.test_bspace(ASubName: String; AExp: array of String; AExpX: Integer;
 
213
  AExpY: Integer);
 
214
begin
 
215
  test_add_undo(ecDeleteLastChar);
 
216
  SynEdit.CommandProcessor(ecDeleteLastChar, '', nil);
 
217
  test_add_undo(ecNone, True);
 
218
  test_assert('BSpace: '+ASubName, AExp, AExpX, AExpY);
 
219
end;
 
220
 
 
221
procedure TTestTrimSpace.test_bspace(ASubName: String; X, Y: Integer; AExp: array of String;
 
222
  AExpX: Integer; AExpY: Integer);
 
223
begin
 
224
  test_add_undo(ecDeleteLastChar);
 
225
  SynEdit.CaretXY := Point(x, y);
 
226
  SynEdit.CommandProcessor(ecDeleteLastChar, '', nil);
 
227
  test_add_undo(ecNone, True);
 
228
  test_assert('BSpace: '+ASubName, AExp, AExpX, AExpY);
 
229
end;
 
230
 
 
231
procedure TTestTrimSpace.test_del(ASubName: String; AExp: array of String; AExpX: Integer;
 
232
  AExpY: Integer);
 
233
begin
 
234
  test_add_undo(ecDeleteChar);
 
235
  SynEdit.CommandProcessor(ecDeleteChar, '', nil);
 
236
  test_add_undo(ecNone, True);
 
237
  test_assert('Del: '+ASubName, AExp, AExpX, AExpY);
 
238
end;
 
239
 
 
240
procedure TTestTrimSpace.test_del(ASubName: String; X, Y: Integer; AExp: array of String;
 
241
  AExpX: Integer; AExpY: Integer);
 
242
begin
 
243
  test_add_undo(ecDeleteChar);
 
244
  SynEdit.CaretXY := Point(x, y);
 
245
  SynEdit.CommandProcessor(ecDeleteChar, '', nil);
 
246
  test_add_undo(ecNone, True);
 
247
  test_assert('Del: '+ASubName, AExp, AExpX, AExpY);
 
248
end;
 
249
 
 
250
procedure TTestTrimSpace.test_undo(ASubName: String; SkipCaretTest: Boolean);
 
251
begin
 
252
  if FUseEc then
 
253
    SynEdit.CommandProcessor(ecUndo, ' ', nil)
 
254
  else
 
255
    SynEdit.Undo;
 
256
  AssertTrue('Undo selftest', FUndoIndex > 0);
 
257
  dec(FUndoIndex);
 
258
  if SkipCaretTest then
 
259
    test_assert('undo: '+ASubName, FUndoList[FUndoIndex].VTextWas,
 
260
                -1, -1,
 
261
                False)
 
262
  else
 
263
    test_assert('undo: '+ASubName, FUndoList[FUndoIndex].VTextWas,
 
264
                FUndoList[FUndoIndex].CaretWas.X, FUndoList[FUndoIndex].CaretWas.Y,
 
265
                False);
 
266
end;
 
267
 
 
268
procedure TTestTrimSpace.test_redo(ASubName: String; SkipCaretTest: Boolean);
 
269
begin
 
270
  if FUseEc then
 
271
    SynEdit.CommandProcessor(ecRedo, ' ', nil)
 
272
  else
 
273
    SynEdit.Redo;
 
274
  assert(FUndoIndex < length(FRedoList));
 
275
  if SkipCaretTest then
 
276
    test_assert('undo: '+ASubName, FRedoList[FUndoIndex].VTextWas,
 
277
                -1, -1,
 
278
                False)
 
279
  else
 
280
    test_assert('undo: '+ASubName, FRedoList[FUndoIndex].VTextWas,
 
281
                FRedoList[FUndoIndex].CaretWas.X, FRedoList[FUndoIndex].CaretWas.Y,
 
282
                False);
 
283
  inc(FUndoIndex);
 
284
end;
 
285
 
 
286
procedure TTestTrimSpace.test_undo_exp(ASubName: String; AExp: String; AExpX: Integer;
 
287
  AExpY: Integer);
96
288
begin
97
289
  if FUseEc then
98
290
    SynEdit.CommandProcessor(ecUndo, ' ', nil)
101
293
  test_assert('undo: '+ASubName, AExp, AExpX, AExpY);
102
294
end;
103
295
 
104
 
Procedure TTestTrimSpace.test_redo(ASubName: String;
105
 
                   AExp: String = ''; AExpX: Integer = -1; AExpY: Integer = -1);
 
296
procedure TTestTrimSpace.test_undo_exp(ASubName: String; AExp: array of String;
 
297
  AExpX: Integer; AExpY: Integer);
 
298
begin
 
299
  test_undo_exp(ASubName, LinesToText(AExp), AExpX, AExpY);
 
300
end;
 
301
 
 
302
procedure TTestTrimSpace.test_redo_exp(ASubName: String; AExp: String; AExpX: Integer;
 
303
  AExpY: Integer);
106
304
begin
107
305
  if FUseEc then
108
306
    SynEdit.CommandProcessor(ecRedo, ' ', nil)
111
309
  test_assert('redo: '+ASubName, AExp, AExpX, AExpY);
112
310
end;
113
311
 
 
312
procedure TTestTrimSpace.test_redo_exp(ASubName: String; AExp: array of String;
 
313
  AExpX: Integer; AExpY: Integer);
 
314
begin
 
315
  test_redo_exp(ASubName, LinesToText(AExp), AExpX, AExpY);
 
316
end;
 
317
 
114
318
procedure TTestTrimSpace.TrimUndoRedo;
 
319
  procedure UndoRedo(AMax: Integer; AName: String = ''; SkipCaretTest: Boolean = False);
 
320
  var
 
321
    i, j: Integer;
 
322
  begin
 
323
    case AMax of
 
324
      1: begin
 
325
          test_undo(AName, SkipCaretTest);
 
326
          test_redo(AName, SkipCaretTest);
 
327
        end;
 
328
      2: begin
 
329
        j := FUndoIndex;
 
330
          for i := 1 to j do test_undo(Format('%s %d/%d', [AName, i, j]), SkipCaretTest);
 
331
          for i := 1 to j do test_redo(Format('%s %d/%d', [AName, i, j]), SkipCaretTest);
 
332
        end;
 
333
    end;
 
334
  end;
 
335
var
 
336
  MaxUndo: Integer;
115
337
begin
 
338
// must have eoScrollPastEol
 
339
// because ForcePastEOL does not work on longest line
 
340
  SynEdit.Options := [eoTrimTrailingSpaces, eoAutoIndent, eoScrollPastEol]; // eoScrollPastEol, eoGroupUndo
 
341
  SynEdit.TabWidth := 6;
 
342
  for MaxUndo := 0 to 2 do begin
 
343
    {%region    settLeaveLine }
 
344
      SynEdit.TrimSpaceType := settLeaveLine;
 
345
 
 
346
      // no trim
 
347
      test_start ('Append Space and text',    ['', 'abc'],        4,2);
 
348
      test_type  ('Space 1',   ' ',           ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
349
      test_type  ('Space 2',   ' ',           ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
350
      test_type  ('Char',      'A',           ['', 'abc  A'],     7,2); UndoRedo(MaxUndo);
 
351
      test_bspace('BackSpace',                ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
352
      test_bspace('BackSpace',                ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
353
      test_bspace('BackSpace',                ['', 'abc'],        4,2); UndoRedo(MaxUndo);
 
354
 
 
355
      // no trim
 
356
      test_start ('Append tab + Space and text', ['', 'abc'],        4,2);
 
357
      test_type  ('tab 1',      #9,              ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
358
      test_type  ('Space 2',   ' ',              ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
359
      test_type  ('Char',      'A',              ['', 'abc'#9' A'],     9,2); UndoRedo(MaxUndo);
 
360
      test_bspace('BackSpace',                   ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
361
      test_bspace('BackSpace',                   ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
362
      test_bspace('BackSpace',                   ['', 'abc'],           4,2); UndoRedo(MaxUndo);
 
363
 
 
364
      // trim on leave line
 
365
      test_start ('Append Space, move left, text, trim', ['', 'abc'],        4,2);
 
366
      test_type  ('Space 1',   ' ',                   ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
367
      test_type  ('Space 2',   ' ',                   ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
368
      test_cmd   ('caret left',ecLeft,                ['', 'abc  '],      5,2,  True);
 
369
      test_type  ('Char',      'A',                   ['', 'abc A '],     6,2); UndoRedo(MaxUndo);
 
370
      test_cmd   ('caret up',  ecUp,                  ['', 'abc A'],      6,1,  True);
 
371
      test_undo  ('');
 
372
 
 
373
      test_start ('Insert CR, and trim space before CR ', ['', 'abc def'],        5,2);
 
374
      test_type  ('CR',        #13,                       ['', 'abc', 'def'],     1,3);
 
375
      UndoRedo(MaxUndo);
 
376
 
 
377
      test_start ('Replace select by CR, and trim before sel', ['', 'abc def,123'],     5,2);
 
378
      SetCaretAndSel(5,2, 8,2); // 'def'
 
379
      test_type  ('CR',        #13,                            ['', 'abc', ',123'],     1,3);
 
380
      UndoRedo(MaxUndo);
 
381
 
 
382
    {%endregion settLeaveLine }
 
383
 
 
384
    {%region    settEditLine }
 
385
      SynEdit.TrimSpaceType := settEditLine;
 
386
 
 
387
      // no trim
 
388
      test_start ('Append Space and text',    ['', 'abc'],        4,2);
 
389
      test_type  ('Space 1',   ' ',           ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
390
      test_type  ('Space 2',   ' ',           ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
391
      test_type  ('Char',      'A',           ['', 'abc  A'],     7,2); UndoRedo(MaxUndo);
 
392
      test_bspace('BackSpace',                ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
393
      test_bspace('BackSpace',                ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
394
      test_bspace('BackSpace',                ['', 'abc'],        4,2); UndoRedo(MaxUndo);
 
395
 
 
396
      // no trim
 
397
      test_start ('Append tab + Space and text', ['', 'abc'],        4,2);
 
398
      test_type  ('tab 1',      #9,              ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
399
      test_type  ('Space 2',   ' ',              ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
400
      test_type  ('Char',      'A',              ['', 'abc'#9' A'],     9,2); UndoRedo(MaxUndo);
 
401
      test_bspace('BackSpace',                   ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
402
      test_bspace('BackSpace',                   ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
403
      test_bspace('BackSpace',                   ['', 'abc'],           4,2); UndoRedo(MaxUndo);
 
404
 
 
405
      // trim on edit
 
406
      test_start ('Append Space, move left, text',    ['', 'abc'],        4,2);
 
407
      test_type  ('Space 1',   ' ',                   ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
408
      test_type  ('Space 2',   ' ',                   ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
409
      test_cmd   ('caret left',ecLeft,                ['', 'abc  '],      5,2,  True);
 
410
      test_type  ('Char',      'A',                   ['', 'abc A'],      6,2); UndoRedo(MaxUndo); // Trimmed on Edit
 
411
      test_cmd   ('caret up',  ecUp,                  ['', 'abc A'],      6,1,  True);
 
412
      test_undo  ('');
 
413
 
 
414
      test_start ('Insert CR, and trim space before CR ', ['', 'abc def'],        5,2);
 
415
      test_type  ('CR',        #13,                       ['', 'abc', 'def'],     1,3);
 
416
      UndoRedo(MaxUndo);
 
417
 
 
418
      test_start ('Replace select by CR, and trim before sel', ['', 'abc def,123'],     5,2);
 
419
      SetCaretAndSel(5,2, 8,2); // 'def'
 
420
      test_type  ('CR',        #13,                            ['', 'abc', ',123'],     1,3);
 
421
      UndoRedo(MaxUndo);
 
422
 
 
423
    {%endregion settEditLine }
 
424
 
 
425
    {%region    settMoveCaret }
 
426
      SynEdit.TrimSpaceType := settMoveCaret;
 
427
 
 
428
      // no trim
 
429
      test_start ('Append Space and text',    ['', 'abc'],        4,2);
 
430
      test_type  ('Space 1',   ' ',           ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
431
      test_type  ('Space 2',   ' ',           ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
432
      test_type  ('Char',      'A',           ['', 'abc  A'],     7,2); UndoRedo(MaxUndo);
 
433
      test_bspace('BackSpace',                ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
434
      test_bspace('BackSpace',                ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
435
      test_bspace('BackSpace',                ['', 'abc'],        4,2); UndoRedo(MaxUndo);
 
436
 
 
437
      // no trim
 
438
      test_start ('Append tab + Space and text', ['', 'abc'],        4,2);
 
439
      test_type  ('tab 1',      #9,              ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
440
      test_type  ('Space 2',   ' ',              ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
441
      test_type  ('Char',      'A',              ['', 'abc'#9' A'],     9,2); UndoRedo(MaxUndo);
 
442
      test_bspace('BackSpace',                   ['', 'abc'#9' '],      8,2); UndoRedo(MaxUndo);
 
443
      test_bspace('BackSpace',                   ['', 'abc'#9],         7,2); UndoRedo(MaxUndo);
 
444
      test_bspace('BackSpace',                   ['', 'abc'],           4,2); UndoRedo(MaxUndo);
 
445
 
 
446
      // trim on move caret
 
447
      test_start ('Append Space, move left, text',    ['', 'abc'],        4,2);
 
448
      test_type  ('Space 1',   ' ',                   ['', 'abc '],       5,2); UndoRedo(MaxUndo);
 
449
      test_type  ('Space 2',   ' ',                   ['', 'abc  '],      6,2); UndoRedo(MaxUndo);
 
450
      test_cmd   ('caret left',ecLeft,                ['', 'abc '],       5,2,  True);
 
451
// TODO: Review: The spacethat was just trimmed, can be undone (leading to an undo that changes nothing)
 
452
      test_type  ('Char',      'A',                   ['', 'abc A'],      6,2); UndoRedo(MaxUndo); // Trimmed on Edit
 
453
      test_cmd   ('caret up',  ecUp,                  ['', 'abc A'],      6,1,  True);
 
454
//TODO: FAIL: This fails with MaxUndo = 2
 
455
//      test_undo  ('');
 
456
 
 
457
      test_start ('Insert CR, and trim space before CR ', ['', 'abc def'],        5,2);
 
458
      test_type  ('CR',        #13,                       ['', 'abc', 'def'],     1,3);
 
459
      UndoRedo(MaxUndo);
 
460
 
 
461
      test_start ('Replace select by CR, and trim before sel', ['', 'abc def,123'],     5,2);
 
462
      SetCaretAndSel(5,2, 8,2); // 'def'
 
463
      test_type  ('CR',        #13,                            ['', 'abc', ',123'],     1,3);
 
464
      UndoRedo(MaxUndo);
 
465
 
 
466
    {%endregion settMoveCaret }
 
467
 
 
468
    {%region    settIgnoreAll }
 
469
      SynEdit.TrimSpaceType := settIgnoreAll;
 
470
 
 
471
      // no trim
 
472
      test_start ('Append Space and text',    ['', 'abc'],        4,2);
 
473
      test_type  ('Space 1',   ' ',           ['', 'abc'],        5,2);
 
474
      test_type  ('Space 2',   ' ',           ['', 'abc'],        6,2);
 
475
      test_type  ('Char',      'A',           ['', 'abc  A'],     7,2);
 
476
      if MaxUndo > 0 then begin
 
477
        test_undo_exp('undo',                   ['', 'abc'],        6,2); // only undo the "A"
 
478
        test_redo_exp('redo',                   ['', 'abc  A'],     7,2);
 
479
      end;
 
480
      test_bspace('BackSpace',                ['', 'abc'],        6,2);
 
481
      test_bspace('BackSpace',                ['', 'abc'],        5,2);
 
482
      test_bspace('BackSpace',                ['', 'abc'],        4,2);
 
483
 
 
484
      // no trim
 
485
      test_start ('Append tab + Space and text', ['', 'abc'],           4,2);
 
486
// TODO: currently tab acts as space, because Log/Phys can not work, if the tab is not present
 
487
      test_type  ('tab 1',      #9,              ['', 'abc'],           7,2);
 
488
      test_type  ('Space 2',   ' ',              ['', 'abc'],           8,2);
 
489
      test_type  ('Char',      'A',              ['', 'abc    A'],     9,2);
 
490
      if MaxUndo > 0 then begin
 
491
        test_undo_exp('undo',                   ['', 'abc'],        8,2); // only undo the "A"
 
492
        test_redo_exp('redo',                   ['', 'abc    A'],     9,2);
 
493
      end;
 
494
      test_bspace('BackSpace',                   ['', 'abc'],           8,2);
 
495
      test_bspace('BackSpace',                   ['', 'abc'],           7,2);
 
496
      test_bspace('BackSpace',                   ['', 'abc'],           6,2);
 
497
 
 
498
      //
 
499
      test_start ('Append Space, move left, text',    ['', 'abc'],        4,2);
 
500
      test_type  ('Space 1',   ' ',                   ['', 'abc'],        5,2);
 
501
      test_type  ('Space 2',   ' ',                   ['', 'abc'],        6,2);
 
502
      test_cmd   ('caret left',ecLeft,                ['', 'abc'],        5,2,  True);
 
503
      test_type  ('Char',      'A',                   ['', 'abc A'],      6,2);
 
504
      test_cmd   ('caret up',  ecUp,                  ['', 'abc A'],      6,1,  True);
 
505
 
 
506
      test_start ('Insert CR, and trim space before CR ', ['', 'abc def'],        5,2);
 
507
      test_type  ('CR',        #13,                       ['', 'abc', 'def'],     1,3);
 
508
      UndoRedo(MaxUndo);
 
509
 
 
510
      test_start ('Replace select by CR, and trim before sel', ['', 'abc def,123'],     5,2);
 
511
      SetCaretAndSel(5,2, 8,2); // 'def'
 
512
      test_type  ('CR',        #13,                            ['', 'abc', ',123'],     1,3);
 
513
      UndoRedo(MaxUndo);
 
514
 
 
515
    {%endregion settIgnoreAll }
 
516
  end;
 
517
 
116
518
  SynEdit.Options := [eoTrimTrailingSpaces, eoAutoIndent, eoScrollPastEol]; // eoGroupUndo
 
519
  SynEdit.TrimSpaceType := settLeaveLine;
117
520
 
118
521
  { Edit Lines }
119
522
  (* *)
121
524
  test_cmd  ('Backspace 6,2', 6,2, ecDeleteLastChar, '', cr+'abc ', 5,2);
122
525
  test_caret('trim', 1,1, cr+'abc', 1,1);
123
526
  // undo
124
 
//#  test_undo('undo trim', cr+'abc ', 5,2);
125
 
  test_undo('undo bspace', cr+'abc d', 6,2);
126
 
  test_redo('redo bspace', cr+'abc ', 5,2);
 
527
//#  test_undo_exp('undo trim', cr+'abc ', 5,2);
 
528
  test_undo_exp('undo bspace', cr+'abc d', 6,2);
 
529
  test_redo_exp('redo bspace', cr+'abc ', 5,2);
127
530
  test_caret('trim', 1,1, cr+'abc', 1,1);
128
531
  // undo again
129
 
//#  test_undo('undo trim(2)', cr+'abc ', 5,2);
130
 
  test_undo('undo bspace(2)', cr+'abc d', 6,2);
131
 
  test_redo('redo bspace(2)', cr+'abc ', 5,2);
132
 
  test_redo('no redo trim(2)', cr+'abc ', 5,2);
 
532
//#  test_undo_exp('undo trim(2)', cr+'abc ', 5,2);
 
533
  test_undo_exp('undo bspace(2)', cr+'abc d', 6,2);
 
534
  test_redo_exp('redo bspace(2)', cr+'abc ', 5,2);
 
535
  test_redo_exp('no redo trim(2)', cr+'abc ', 5,2);
133
536
  // undo again
134
537
  test_caret('trim(3)', 1,1, cr+'abc', 1,1);
135
 
//#  test_undo('undo trim(3)', cr+'abc ', 5,2);
 
538
//#  test_undo_exp('undo trim(3)', cr+'abc ', 5,2);
136
539
//##  test_caret('trim(3)', 1,1, cr+'abc', 1,1);
137
540
 
138
541
  (* *)
139
542
  test_start('insert past real space', cr+'abc ');
140
543
  test_cmd  ('insert 5,2', 5,2, ecChar, 'x', cr+'abc x', 6,2);
141
544
  // undo
142
 
  test_undo('undo insert', cr+'abc ', 5,2);
 
545
  test_undo_exp('undo insert', cr+'abc ', 5,2);
143
546
  test_caret('no trim', 1,1, cr+'abc ', 1,1);
144
547
  // rdeo/undo again
145
 
  test_redo('redo insert', cr+'abc x', 6,2);
146
 
  test_undo('undo insert(2)', cr+'abc ', 5,2);
 
548
  test_redo_exp('redo insert', cr+'abc x', 6,2);
 
549
  test_undo_exp('undo insert(2)', cr+'abc ', 5,2);
147
550
  test_caret('no trim(2)', 1,1, cr+'abc ', 1,1);
148
551
 
149
552
  (* *)
151
554
  test_cmd  ('insert 5,2', 5,2, ecChar, ' ', cr+'abc  ', 6,2);
152
555
  test_cmd  ('insert 6,2', 6,2, ecChar, ' ', cr+'abc   ', 7,2);
153
556
  // undo
154
 
  test_undo('undo insert2', cr+'abc  ', 6,2);
155
 
  test_undo('undo insert1', cr+'abc ',  5,2);
 
557
  test_undo_exp('undo insert2', cr+'abc  ', 6,2);
 
558
  test_undo_exp('undo insert1', cr+'abc ',  5,2);
156
559
  test_caret('no trim', 1,1, cr+'abc ', 1,1);
157
560
  // rdeo/undo again
158
 
  test_redo('redo insert1', cr+'abc  ',  6,2);
159
 
  test_redo('redo insert2', cr+'abc   ', 7,2);
160
 
  test_undo('undo inserts2(2)', cr+'abc  ', 6,2);
161
 
  test_undo('undo inserts1(2)', cr+'abc ',  5,2);
 
561
  test_redo_exp('redo insert1', cr+'abc  ',  6,2);
 
562
  test_redo_exp('redo insert2', cr+'abc   ', 7,2);
 
563
  test_undo_exp('undo inserts2(2)', cr+'abc  ', 6,2);
 
564
  test_undo_exp('undo inserts1(2)', cr+'abc ',  5,2);
162
565
  test_caret('no trim(2)', 1,1, cr+'abc ', 1,1);
163
566
 
164
567
 
167
570
  test_cmd  ('insert 4,2', 4,2, ecChar, ' ', cr+'abc ',  5,2);
168
571
  test_cmd  ('insert 5,2', 5,2, ecChar, 'x', cr+'abc x', 6,2);
169
572
  // undo
170
 
  test_undo('undo ins char', cr+'abc ', 5,2);
 
573
  test_undo_exp('undo ins char', cr+'abc ', 5,2);
171
574
  test_caret('trim', 1,1, cr+'abc', 1,1); /// xxx this undo, remose the ability to redo....
172
575
 
173
576
  (* *)
175
578
  test_cmd  ('insert 4,2', 4,2, ecChar, ' ', cr+'ab  ',  5,2);
176
579
  test_cmd  ('insert 5,2', 5,2, ecChar, 'x', cr+'ab  x', 6,2);
177
580
  // undo
178
 
  test_undo('undo ins char', cr+'ab  ', 5,2);
 
581
  test_undo_exp('undo ins char', cr+'ab  ', 5,2);
179
582
  test_caret('trim', 1,1, cr+'ab', 1,1); /// xxx this undo, remose the ability to redo.... xxxxxxxxxxxxxxxx
180
583
  // We can no longer undo back to the real space
181
584
 
184
587
  test_cmd  ('insert 4,2', 4,2, ecChar, ' ', cr+'ab  ',  5,2);
185
588
  test_cmd  ('insert 5,2', 5,2, ecChar, 'x', cr+'ab  x', 6,2);
186
589
  // undo
187
 
  test_undo('undo ins char', cr+'ab  ', 5,2);
188
 
  test_undo('undo ins space', cr+'ab ', 4,2);
 
590
  test_undo_exp('undo ins char', cr+'ab  ', 5,2);
 
591
  test_undo_exp('undo ins space', cr+'ab ', 4,2);
189
592
  test_caret('no trim', 1,1, cr+'ab ', 1,1); /// xxx this undo, remose the ability to redo....
190
593
 
191
594
  (* *)
192
595
  test_start('insert past eol', cr+'abc ');
193
596
  test_cmd  ('insert 8,2', 8,2, ecChar, 'x', cr+'abc    x', 9,2);
194
 
  test_undo('undo insert', cr+'abc ', 8,2);
 
597
  test_undo_exp('undo insert', cr+'abc ', 8,2);
195
598
  test_caret('trim', 1,1, cr+'abc ', 1,1);
196
599
  // TODO: redo
197
600
 
200
603
  test_start('insert newline', cr+'ab 1234 ');
201
604
  test_cmd  ('insert 4,2', 4,2, ecLineBreak, ' ', cr+'ab'+cr+'1234 ',  1,3);
202
605
  test_caret('trim', 1,1, cr+'ab'+cr+'1234', 1,1);
203
 
//#  test_undo('-trim', cr+'ab'+cr+'1234 ', 6,3);  // TODO caret at:   1,3);
204
 
  test_undo('-newline', cr+'ab 1234 ', 4,2);
 
606
//#  test_undo_exp('-trim', cr+'ab'+cr+'1234 ', 6,3);  // TODO caret at:   1,3);
 
607
  test_undo_exp('-newline', cr+'ab 1234 ', 4,2);
205
608
  test_caret('no trim', 1,1, cr+'ab 1234 ', 1,1);
206
609
 
207
610
  (* *)
210
613
  test_cmd  ('insert 3,3', 3,3, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+'  ',        3,4);
211
614
  test_cmd  ('insert 3,4', 3,4, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+''+cr+'  ',  3,5);
212
615
  test_caret('trim', 1,1, cr+'  ab'+cr+''+cr+''+cr+'', 1,1);
213
 
//#  test_undo('-trim',      cr+'  ab'+cr+''+cr+''+cr+'  ', 3,5);
214
 
  test_undo('-newlin 1', cr+'  ab'+cr+''+cr+'  ',       3,4);
215
 
  test_undo('-newlin 2', cr+'  ab'+cr+'  ',             3,3);
216
 
  test_undo('-newlin 3', cr+'  ab ',                    6,2);
 
616
//#  test_undo_exp('-trim',      cr+'  ab'+cr+''+cr+''+cr+'  ', 3,5);
 
617
  test_undo_exp('-newlin 1', cr+'  ab'+cr+''+cr+'  ',       3,4);
 
618
  test_undo_exp('-newlin 2', cr+'  ab'+cr+'  ',             3,3);
 
619
  test_undo_exp('-newlin 3', cr+'  ab ',                    6,2);
217
620
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
218
 
  test_redo('redo 3',    cr+'  ab'+cr+'  ', 3,3);
219
 
  test_redo('redo 2',    cr+'  ab'+cr+''+cr+'  ', 3,4);
220
 
  test_redo('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'  ', 3,5);
221
 
  test_undo('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'  ',       3,4);
222
 
  test_undo('-newlin 2(r)',  cr+'  ab'+cr+'  ',             3,3);
223
 
  test_undo('-newlin 3(r)',  cr+'  ab ',                    6,2);
 
621
  test_redo_exp('redo 3',    cr+'  ab'+cr+'  ', 3,3);
 
622
  test_redo_exp('redo 2',    cr+'  ab'+cr+''+cr+'  ', 3,4);
 
623
  test_redo_exp('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'  ', 3,5);
 
624
  test_undo_exp('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'  ',       3,4);
 
625
  test_undo_exp('-newlin 2(r)',  cr+'  ab'+cr+'  ',             3,3);
 
626
  test_undo_exp('-newlin 3(r)',  cr+'  ab ',                    6,2);
224
627
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
225
628
 
226
629
  (* *)
229
632
  test_cmd  ('insert 3,3', 3,3, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+'   ',        3,4);
230
633
  test_cmd  ('insert 3,4', 3,4, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+''+cr+'   ',  3,5);
231
634
  test_caret('trim', 1,1, cr+'  ab'+cr+''+cr+''+cr+'', 1,1);
232
 
//#  test_undo('-trim',      cr+'  ab'+cr+''+cr+''+cr+'   ', 4,5); // TODO caret at:   3,5);
233
 
  test_undo('-newlin 1', cr+'  ab'+cr+''+cr+'   ',        3,4);
234
 
  test_undo('-newlin 2', cr+'  ab'+cr+'   ',              3,3);
235
 
  test_undo('-newlin 3', cr+'  ab ',                      5,2);
 
635
//#  test_undo_exp('-trim',      cr+'  ab'+cr+''+cr+''+cr+'   ', 4,5); // TODO caret at:   3,5);
 
636
  test_undo_exp('-newlin 1', cr+'  ab'+cr+''+cr+'   ',        3,4);
 
637
  test_undo_exp('-newlin 2', cr+'  ab'+cr+'   ',              3,3);
 
638
  test_undo_exp('-newlin 3', cr+'  ab ',                      5,2);
236
639
  test_caret('no trim', 1,1, cr+'  ab ',           1,1);
237
 
  test_redo('redo 3',    cr+'  ab'+cr+'   ',       3,3);
238
 
  test_redo('redo 2',    cr+'  ab'+cr+''+cr+'   ', 3,4);
239
 
  test_redo('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'   ', 3,5);
240
 
  test_undo('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'   ',       3,4);
241
 
  test_undo('-newlin 2(r)',  cr+'  ab'+cr+'   ',             3,3);
242
 
  test_undo('-newlin 3(r)',  cr+'  ab ',                     5,2);
 
640
  test_redo_exp('redo 3',    cr+'  ab'+cr+'   ',       3,3);
 
641
  test_redo_exp('redo 2',    cr+'  ab'+cr+''+cr+'   ', 3,4);
 
642
  test_redo_exp('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'   ', 3,5);
 
643
  test_undo_exp('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'   ',       3,4);
 
644
  test_undo_exp('-newlin 2(r)',  cr+'  ab'+cr+'   ',             3,3);
 
645
  test_undo_exp('-newlin 3(r)',  cr+'  ab ',                     5,2);
243
646
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
244
647
 
245
648
  (* *)
246
649
  test_start('insert linebreak', cr+'ab 1234 ');
247
650
  test_cmd  ('insert 4,2', 4,2, ecInsertLine, ' ', cr+'ab '+cr+'1234',  4,2);
248
651
  test_caret('trim', 1,1, cr+'ab'+cr+'1234', 1,1);
249
 
//#  test_undo('-trim', cr+'ab '+cr+'1234', 4,2);
250
 
  test_undo('-linebreak', cr+'ab 1234 ', 4,2);
 
652
//#  test_undo_exp('-trim', cr+'ab '+cr+'1234', 4,2);
 
653
  test_undo_exp('-linebreak', cr+'ab 1234 ', 4,2);
251
654
  test_caret('no trim', 1,1, cr+'ab 1234 ', 1,1);
252
655
 
253
656
  (* *)
255
658
  test_cmd  ('insert1 6,2', 6,2, ecInsertLine, ' ', cr+'  ab '+cr+'',  6,2);
256
659
  test_cmd  ('insert2 6,2', 6,2, ecInsertLine, ' ', cr+'  ab '+cr+''+cr+'',  6,2);
257
660
  test_caret('trim', 1,1, cr+'  ab'+cr+''+cr+'', 1,1);
258
 
//#  test_undo('-trim',      cr+'  ab '+cr+''+cr+'', 6,2);
259
 
  test_undo('-linebreak 1', cr+'  ab '+cr+'',     6,2);
260
 
  test_undo('-linebreak 2', cr+'  ab ',           6,2);
 
661
//#  test_undo_exp('-trim',      cr+'  ab '+cr+''+cr+'', 6,2);
 
662
  test_undo_exp('-linebreak 1', cr+'  ab '+cr+'',     6,2);
 
663
  test_undo_exp('-linebreak 2', cr+'  ab ',           6,2);
261
664
  test_caret('no trim', 1,1, cr+'  ab ',          1,1);
262
665
(*
263
 
  test_redo('redo 2',    cr+'  ab '+cr+'',        6,2);
264
 
  test_redo('redo 1',    cr+'  ab '+cr+''+cr+'',  6,2);
265
 
  test_undo('-linebreak 1(r)',  cr+'  ab '+cr+'', 6,2);
266
 
  test_undo('-linebreak 2(r)',  cr+'  ab ',        6,2);
 
666
  test_redo_exp('redo 2',    cr+'  ab '+cr+'',        6,2);
 
667
  test_redo_exp('redo 1',    cr+'  ab '+cr+''+cr+'',  6,2);
 
668
  test_undo_exp('-linebreak 1(r)',  cr+'  ab '+cr+'', 6,2);
 
669
  test_undo_exp('-linebreak 2(r)',  cr+'  ab ',        6,2);
267
670
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
268
671
*)
269
672
 
272
675
  test_cmd  ('insert1 5,2', 5,2, ecInsertLine, ' ', cr+'  ab'+cr+'',  5,2);
273
676
  test_cmd  ('insert2 5,2', 5,2, ecInsertLine, ' ', cr+'  ab'+cr+''+cr+'',  5,2);
274
677
  test_caret('no trim (0 spaces)', 1,1, cr+'  ab'+cr+''+cr+'', 1,1);
275
 
  test_undo('-linebreak 1', cr+'  ab'+cr+'',     5,2);
276
 
  test_undo('-linebreak 2', cr+'  ab ',          5,2);
 
678
  test_undo_exp('-linebreak 1', cr+'  ab'+cr+'',     5,2);
 
679
  test_undo_exp('-linebreak 2', cr+'  ab ',          5,2);
277
680
  test_caret('no trim', 1,1, cr+'  ab ',         1,1);
278
681
(*
279
 
  test_redo('redo 2',    cr+'  ab'+cr+'',       5,2);
280
 
  test_redo('redo 1',    cr+'  ab'+cr+''+cr+'', 5,2);
281
 
  test_undo('-linebreak 1(r)',  cr+'  ab'+cr+'', 5,2);
282
 
  test_undo('-linebreak 2(r)',  cr+'  ab ',      5,2);
 
682
  test_redo_exp('redo 2',    cr+'  ab'+cr+'',       5,2);
 
683
  test_redo_exp('redo 1',    cr+'  ab'+cr+''+cr+'', 5,2);
 
684
  test_undo_exp('-linebreak 1(r)',  cr+'  ab'+cr+'', 5,2);
 
685
  test_undo_exp('-linebreak 2(r)',  cr+'  ab ',      5,2);
283
686
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
284
687
*)
285
688
 
287
690
  (* *)
288
691
  test_start('del',       cr+'ab '+cr+'12');
289
692
  test_cmd  ('del 4,2', 4,2, ecDeleteChar, ' ', cr+'ab 12',  4,2);
290
 
  test_undo('-del',       cr+'ab '+cr+'12',     4,2);
 
693
  test_undo_exp('-del',       cr+'ab '+cr+'12',     4,2);
291
694
  test_caret('trim', 1,1, cr+'ab '+cr+'12', 1,1);
292
 
  test_redo('+del',       cr+'ab 12',     4,2);
293
 
  test_undo('-del(2)',    cr+'ab '+cr+'12',     4,2);
 
695
  test_redo_exp('+del',       cr+'ab 12',     4,2);
 
696
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12',     4,2);
294
697
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
295
698
 
296
699
  (* *)
297
700
  test_start('del (both sp)',       cr+'ab '+cr+'12 ');
298
701
  test_cmd  ('del 4,2', 4,2, ecDeleteChar, ' ', cr+'ab 12 ',  4,2);
299
 
  test_undo('-del',       cr+'ab '+cr+'12 ',     4,2);
 
702
  test_undo_exp('-del',       cr+'ab '+cr+'12 ',     4,2);
300
703
  test_caret('trim', 1,1, cr+'ab '+cr+'12 ', 1,1);
301
 
  test_redo('+del',       cr+'ab 12 ',     4,2);
302
 
  test_undo('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
 
704
  test_redo_exp('+del',       cr+'ab 12 ',     4,2);
 
705
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
303
706
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12 ', 1,1);
304
707
 
305
708
  (* *)
306
709
  test_start('del past eol',       cr+'ab '+cr+'12');
307
710
  test_cmd  ('del 6,2', 6,2, ecDeleteChar, ' ', cr+'ab   12',  6,2);
308
 
  test_undo('-del',        cr+'ab '+cr+'12',  6,2);
 
711
  test_undo_exp('-del',        cr+'ab '+cr+'12',  6,2);
309
712
  test_caret('no trim', 1,1,  cr+'ab '+cr+'12',  1,1);
310
713
  test_caret('-no trim', 6,2, cr+'ab '+cr+'12',  6,2);
311
 
  test_redo('+del(2)',       cr+'ab   12',     6,2);
312
 
  test_undo('-del(2)',    cr+'ab '+cr+'12', 6,2);
 
714
  test_redo_exp('+del(2)',       cr+'ab   12',     6,2);
 
715
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12', 6,2);
313
716
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
314
 
  test_redo('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
 
717
  test_redo_exp('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
315
718
 
316
719
  (* *)
317
720
  test_start('backspace', cr+'ab '+cr+'12');
318
721
  test_cmd  ('bs 1,3', 1,3, ecDeleteLastChar, ' ', cr+'ab 12',  4,2);
319
 
  test_undo('-bs',    cr+'ab '+cr+'12',     1,3);
 
722
  test_undo_exp('-bs',    cr+'ab '+cr+'12',     1,3);
320
723
  test_caret('trim', 1,1, cr+'ab '+cr+'12', 1,1);
321
 
  test_redo('+bs',    cr+'ab 12',     4,2);
322
 
  test_undo('-bs(2)', cr+'ab '+cr+'12',     1,3);
 
724
  test_redo_exp('+bs',    cr+'ab 12',     4,2);
 
725
  test_undo_exp('-bs(2)', cr+'ab '+cr+'12',     1,3);
323
726
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
324
727
 
325
728
  (* *)
326
729
  test_start('del-word',       cr+'ab '+cr+'12');
327
730
  test_cmd  ('del 4,2', 4,2, ecDeleteWord, ' ', cr+'ab 12',  4,2);
328
 
  test_undo('-del',       cr+'ab '+cr+'12',     4,2);
 
731
  test_undo_exp('-del',       cr+'ab '+cr+'12',     4,2);
329
732
  test_caret('no trim', 1,1, cr+'ab '+cr+'12', 1,1);
330
 
  test_redo('+del',       cr+'ab 12',     4,2);
331
 
  test_undo('-del(2)',    cr+'ab '+cr+'12',     4,2);
 
733
  test_redo_exp('+del',       cr+'ab 12',     4,2);
 
734
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12',     4,2);
332
735
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
333
736
 
334
737
  (* *)
335
738
  test_start('del-word (both sp)',       cr+'ab '+cr+'12 ');
336
739
  test_cmd  ('del 4,2', 4,2, ecDeleteWord, ' ', cr+'ab 12 ',  4,2);
337
740
(* xxxxxxxxxxxxxxx
338
 
  test_undo('-del',       cr+'ab '+cr+'12 ',     4,2);
 
741
  test_undo_exp('-del',       cr+'ab '+cr+'12 ',     4,2);
339
742
  test_caret('trim', 1,1, cr+'ab '+cr+'12 ', 1,1);
340
 
  test_redo('+del',       cr+'ab 12 ',     4,2);
341
 
  test_undo('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
 
743
  test_redo_exp('+del',       cr+'ab 12 ',     4,2);
 
744
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
342
745
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12 ', 1,1);
343
746
*)
344
747
 
345
748
  (* *)
346
749
  test_start('del-word past eol',       cr+'ab '+cr+'12');
347
750
  test_cmd  ('del 6,2', 6,2, ecDeleteWord, ' ', cr+'ab   12',  6,2);
348
 
  test_undo('-del',        cr+'ab '+cr+'12',  6,2);
 
751
  test_undo_exp('-del',        cr+'ab '+cr+'12',  6,2);
349
752
  test_caret('trim', 1,1,  cr+'ab '+cr+'12',  1,1);
350
753
  test_caret('-trim', 6,2, cr+'ab '+cr+'12',  6,2);
351
 
  test_redo('+del(2)',       cr+'ab   12',     6,2);
352
 
  test_undo('-del(2)',    cr+'ab '+cr+'12', 6,2);
 
754
  test_redo_exp('+del(2)',       cr+'ab   12',     6,2);
 
755
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12', 6,2);
353
756
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
354
 
  test_redo('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
 
757
  test_redo_exp('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
355
758
 
356
759
end;
357
760
 
371
774
  test_start('insert newline', cr+'ab 1234 ');
372
775
  test_cmd  ('insert 4,2', 4,2, ecLineBreak, ' ', cr+'ab '+cr+'1234 ',  1,3);
373
776
  test_caret('trim', 1,1, cr+'ab '+cr+'1234 ', 1,1);
374
 
  test_undo('-newline', cr+'ab 1234 ', 4,2);
 
777
  test_undo_exp('-newline', cr+'ab 1234 ', 4,2);
375
778
  test_caret('no trim', 1,1, cr+'ab 1234 ', 1,1);
376
779
 
377
780
  (* *)
380
783
  test_cmd  ('insert 3,3', 3,3, ecLineBreak, ' ', cr+'  ab '+cr+'  '+cr+'  ',          3,4);
381
784
  test_cmd  ('insert 3,4', 3,4, ecLineBreak, ' ', cr+'  ab '+cr+'  '+cr+'  '+cr+'  ',  3,5);
382
785
  test_caret('trim', 1,1, cr+'  ab '+cr+'  '+cr+'  '+cr+'  ', 1,1);
383
 
  test_undo('-newlin 1', cr+'  ab '+cr+'  '+cr+'  ',       3,4);
384
 
  test_undo('-newlin 2', cr+'  ab '+cr+'  ',               3,3);
385
 
  test_undo('-newlin 3', cr+'  ab ',                      6,2);
 
786
  test_undo_exp('-newlin 1', cr+'  ab '+cr+'  '+cr+'  ',       3,4);
 
787
  test_undo_exp('-newlin 2', cr+'  ab '+cr+'  ',               3,3);
 
788
  test_undo_exp('-newlin 3', cr+'  ab ',                      6,2);
386
789
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
387
 
  test_redo('redo 3',    cr+'  ab '+cr+'  ',                 3,3);
388
 
  test_redo('redo 2',    cr+'  ab '+cr+'  '+cr+'  ',         3,4);
389
 
  test_redo('redo 1',    cr+'  ab '+cr+'  '+cr+'  '+cr+'  ', 3,5);
390
 
  test_undo('-newlin 1(r)',  cr+'  ab '+cr+'  '+cr+'  ',     3,4);
391
 
  test_undo('-newlin 2(r)',  cr+'  ab '+cr+'  ',             3,3);
392
 
  test_undo('-newlin 3(r)',  cr+'  ab ',                    6,2);
 
790
  test_redo_exp('redo 3',    cr+'  ab '+cr+'  ',                 3,3);
 
791
  test_redo_exp('redo 2',    cr+'  ab '+cr+'  '+cr+'  ',         3,4);
 
792
  test_redo_exp('redo 1',    cr+'  ab '+cr+'  '+cr+'  '+cr+'  ', 3,5);
 
793
  test_undo_exp('-newlin 1(r)',  cr+'  ab '+cr+'  '+cr+'  ',     3,4);
 
794
  test_undo_exp('-newlin 2(r)',  cr+'  ab '+cr+'  ',             3,3);
 
795
  test_undo_exp('-newlin 3(r)',  cr+'  ab ',                    6,2);
393
796
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
394
797
 
395
798
(*
399
802
  test_cmd  ('insert 3,3', 3,3, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+'   ',        3,4);
400
803
  test_cmd  ('insert 3,4', 3,4, ecLineBreak, ' ', cr+'  ab'+cr+''+cr+''+cr+'   ',  3,5);
401
804
  test_caret('trim', 1,1, cr+'  ab'+cr+''+cr+''+cr+'', 1,1);
402
 
  test_undo('-trim',      cr+'  ab'+cr+''+cr+''+cr+'   ', 4,5); // TODO caret at:   3,5);
403
 
  test_undo('-newlin 1', cr+'  ab'+cr+''+cr+'   ',        3,4);
404
 
  test_undo('-newlin 2', cr+'  ab'+cr+'   ',              3,3);
405
 
  test_undo('-newlin 3', cr+'  ab ',                      5,2);
 
805
  test_undo_exp('-trim',      cr+'  ab'+cr+''+cr+''+cr+'   ', 4,5); // TODO caret at:   3,5);
 
806
  test_undo_exp('-newlin 1', cr+'  ab'+cr+''+cr+'   ',        3,4);
 
807
  test_undo_exp('-newlin 2', cr+'  ab'+cr+'   ',              3,3);
 
808
  test_undo_exp('-newlin 3', cr+'  ab ',                      5,2);
406
809
  test_caret('no trim', 1,1, cr+'  ab ',           1,1);
407
 
  test_redo('redo 3',    cr+'  ab'+cr+'   ',       3,3);
408
 
  test_redo('redo 2',    cr+'  ab'+cr+''+cr+'   ', 3,4);
409
 
  test_redo('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'   ', 3,5);
410
 
  test_undo('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'   ',       3,4);
411
 
  test_undo('-newlin 2(r)',  cr+'  ab'+cr+'   ',             3,3);
412
 
  test_undo('-newlin 3(r)',  cr+'  ab ',                     5,2);
 
810
  test_redo_exp('redo 3',    cr+'  ab'+cr+'   ',       3,3);
 
811
  test_redo_exp('redo 2',    cr+'  ab'+cr+''+cr+'   ', 3,4);
 
812
  test_redo_exp('redo 1',    cr+'  ab'+cr+''+cr+''+cr+'   ', 3,5);
 
813
  test_undo_exp('-newlin 1(r)',  cr+'  ab'+cr+''+cr+'   ',       3,4);
 
814
  test_undo_exp('-newlin 2(r)',  cr+'  ab'+cr+'   ',             3,3);
 
815
  test_undo_exp('-newlin 3(r)',  cr+'  ab ',                     5,2);
413
816
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
414
817
 
415
818
 
417
820
  test_start('insert linebreak', cr+'ab 1234 ');
418
821
  test_cmd  ('insert 4,2', 4,2, ecInsertLine, ' ', cr+'ab '+cr+'1234',  4,2);
419
822
  test_caret('trim', 1,1, cr+'ab'+cr+'1234', 1,1);
420
 
  test_undo('-trim', cr+'ab '+cr+'1234', 4,2);
421
 
  test_undo('-linebreak', cr+'ab 1234 ', 4,2);
 
823
  test_undo_exp('-trim', cr+'ab '+cr+'1234', 4,2);
 
824
  test_undo_exp('-linebreak', cr+'ab 1234 ', 4,2);
422
825
  test_caret('no trim', 1,1, cr+'ab 1234 ', 1,1);
423
826
 
424
827
  (* *)
426
829
  test_cmd  ('insert1 6,2', 6,2, ecInsertLine, ' ', cr+'  ab '+cr+'',  6,2);
427
830
  test_cmd  ('insert2 6,2', 6,2, ecInsertLine, ' ', cr+'  ab '+cr+''+cr+'',  6,2);
428
831
  test_caret('trim', 1,1, cr+'  ab'+cr+''+cr+'', 1,1);
429
 
  test_undo('-trim',      cr+'  ab '+cr+''+cr+'', 6,2);
430
 
  test_undo('-linebreak 1', cr+'  ab '+cr+'',     6,2);
431
 
  test_undo('-linebreak 2', cr+'  ab ',           6,2);
 
832
  test_undo_exp('-trim',      cr+'  ab '+cr+''+cr+'', 6,2);
 
833
  test_undo_exp('-linebreak 1', cr+'  ab '+cr+'',     6,2);
 
834
  test_undo_exp('-linebreak 2', cr+'  ab ',           6,2);
432
835
  test_caret('no trim', 1,1, cr+'  ab ',          1,1);
433
836
(*
434
 
  test_redo('redo 2',    cr+'  ab '+cr+'',        6,2);
435
 
  test_redo('redo 1',    cr+'  ab '+cr+''+cr+'',  6,2);
436
 
  test_undo('-linebreak 1(r)',  cr+'  ab '+cr+'', 6,2);
437
 
  test_undo('-linebreak 2(r)',  cr+'  ab ',        6,2);
 
837
  test_redo_exp('redo 2',    cr+'  ab '+cr+'',        6,2);
 
838
  test_redo_exp('redo 1',    cr+'  ab '+cr+''+cr+'',  6,2);
 
839
  test_undo_exp('-linebreak 1(r)',  cr+'  ab '+cr+'', 6,2);
 
840
  test_undo_exp('-linebreak 2(r)',  cr+'  ab ',        6,2);
438
841
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
439
842
*)
440
843
 
443
846
  test_cmd  ('insert1 5,2', 5,2, ecInsertLine, ' ', cr+'  ab'+cr+'',  5,2);
444
847
  test_cmd  ('insert2 5,2', 5,2, ecInsertLine, ' ', cr+'  ab'+cr+''+cr+'',  5,2);
445
848
  test_caret('no trim (0 spaces)', 1,1, cr+'  ab'+cr+''+cr+'', 1,1);
446
 
  test_undo('-linebreak 1', cr+'  ab'+cr+'',     5,2);
447
 
  test_undo('-linebreak 2', cr+'  ab ',          5,2);
 
849
  test_undo_exp('-linebreak 1', cr+'  ab'+cr+'',     5,2);
 
850
  test_undo_exp('-linebreak 2', cr+'  ab ',          5,2);
448
851
  test_caret('no trim', 1,1, cr+'  ab ',         1,1);
449
852
(*
450
 
  test_redo('redo 2',    cr+'  ab'+cr+'',       5,2);
451
 
  test_redo('redo 1',    cr+'  ab'+cr+''+cr+'', 5,2);
452
 
  test_undo('-linebreak 1(r)',  cr+'  ab'+cr+'', 5,2);
453
 
  test_undo('-linebreak 2(r)',  cr+'  ab ',      5,2);
 
853
  test_redo_exp('redo 2',    cr+'  ab'+cr+'',       5,2);
 
854
  test_redo_exp('redo 1',    cr+'  ab'+cr+''+cr+'', 5,2);
 
855
  test_undo_exp('-linebreak 1(r)',  cr+'  ab'+cr+'', 5,2);
 
856
  test_undo_exp('-linebreak 2(r)',  cr+'  ab ',      5,2);
454
857
  test_caret('no trim', 1,1, cr+'  ab ', 1,1);
455
858
*)
456
859
*)
459
862
  (* *)
460
863
  test_start('del',       cr+'ab '+cr+'12');
461
864
  test_cmd  ('del 4,2', 4,2, ecDeleteChar, ' ', cr+'ab 12',  4,2);
462
 
  test_undo('-del',       cr+'ab '+cr+'12',     4,2);
 
865
  test_undo_exp('-del',       cr+'ab '+cr+'12',     4,2);
463
866
  test_caret('trim', 1,1, cr+'ab '+cr+'12', 1,1);
464
 
  test_redo('+del',       cr+'ab 12',     4,2);
465
 
  test_undo('-del(2)',    cr+'ab '+cr+'12',     4,2);
 
867
  test_redo_exp('+del',       cr+'ab 12',     4,2);
 
868
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12',     4,2);
466
869
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
467
870
 
468
871
  (* *)
469
872
  test_start('del (both sp)',       cr+'ab '+cr+'12 ');
470
873
  test_cmd  ('del 4,2', 4,2, ecDeleteChar, ' ', cr+'ab 12 ',  4,2);
471
 
  test_undo('-del',       cr+'ab '+cr+'12 ',     4,2);
 
874
  test_undo_exp('-del',       cr+'ab '+cr+'12 ',     4,2);
472
875
  test_caret('trim', 1,1, cr+'ab '+cr+'12 ', 1,1);
473
 
  test_redo('+del',       cr+'ab 12 ',     4,2);
474
 
  test_undo('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
 
876
  test_redo_exp('+del',       cr+'ab 12 ',     4,2);
 
877
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
475
878
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12 ', 1,1);
476
879
 
477
880
  (* *)
478
881
  test_start('del past eol',       cr+'ab '+cr+'12');
479
882
  test_cmd  ('del 6,2', 6,2, ecDeleteChar, ' ', cr+'ab   12',  6,2);
480
 
  test_undo('-del',        cr+'ab '+cr+'12',  6,2);
 
883
  test_undo_exp('-del',        cr+'ab '+cr+'12',  6,2);
481
884
  test_caret('trim', 1,1,  cr+'ab '+cr+'12',  1,1);
482
885
  test_caret('-trim', 6,2, cr+'ab '+cr+'12',  6,2);
483
886
(*
484
 
  test_redo('+del(2)',       cr+'ab   12',     6,2);
485
 
  test_undo('-del(2)',    cr+'ab '+cr+'12', 6,2);
 
887
  test_redo_exp('+del(2)',       cr+'ab   12',     6,2);
 
888
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12', 6,2);
486
889
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
487
 
  test_redo('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
 
890
  test_redo_exp('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
488
891
*)
489
892
 
490
893
  (* *)
491
894
  test_start('backspace', cr+'ab '+cr+'12');
492
895
  test_cmd  ('bs 1,3', 1,3, ecDeleteLastChar, ' ', cr+'ab 12',  4,2);
493
 
  test_undo('-bs',    cr+'ab '+cr+'12',     1,3);
 
896
  test_undo_exp('-bs',    cr+'ab '+cr+'12',     1,3);
494
897
  test_caret('trim', 1,1, cr+'ab '+cr+'12', 1,1);
495
 
  test_redo('+bs',    cr+'ab 12',     4,2);
496
 
  test_undo('-bs(2)', cr+'ab '+cr+'12',     1,3);
 
898
  test_redo_exp('+bs',    cr+'ab 12',     4,2);
 
899
  test_undo_exp('-bs(2)', cr+'ab '+cr+'12',     1,3);
497
900
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
498
901
 
499
902
  (* *)
500
903
  test_start('del-word',       cr+'ab '+cr+'12');
501
904
  test_cmd  ('del 4,2', 4,2, ecDeleteWord, ' ', cr+'ab 12',  4,2);
502
 
  test_undo('-del',       cr+'ab '+cr+'12',     4,2);
 
905
  test_undo_exp('-del',       cr+'ab '+cr+'12',     4,2);
503
906
  test_caret('trim', 1,1, cr+'ab '+cr+'12', 1,1);
504
 
  test_redo('+del',       cr+'ab 12',     4,2);
505
 
  test_undo('-del(2)',    cr+'ab '+cr+'12',     4,2);
 
907
  test_redo_exp('+del',       cr+'ab 12',     4,2);
 
908
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12',     4,2);
506
909
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
507
910
 
508
911
  (* *)
509
912
  test_start('del-word (both sp)',       cr+'ab '+cr+'12 ');
510
913
  test_cmd  ('del 4,2', 4,2, ecDeleteWord, ' ', cr+'ab 12 ',  4,2);
511
 
  test_undo('-del',       cr+'ab '+cr+'12 ',     4,2);
 
914
  test_undo_exp('-del',       cr+'ab '+cr+'12 ',     4,2);
512
915
  test_caret('trim', 1,1, cr+'ab '+cr+'12 ', 1,1);
513
 
  test_redo('+del',       cr+'ab 12 ',     4,2);
514
 
  test_undo('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
 
916
  test_redo_exp('+del',       cr+'ab 12 ',     4,2);
 
917
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12 ',     4,2);
515
918
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12 ', 1,1);
516
919
 
517
920
  (* *)
518
921
  test_start('del-word past eol',       cr+'ab '+cr+'12');
519
922
  test_cmd  ('del 6,2', 6,2, ecDeleteWord, ' ', cr+'ab   12',  6,2);
520
 
  test_undo('-del',        cr+'ab '+cr+'12',  6,2);
 
923
  test_undo_exp('-del',        cr+'ab '+cr+'12',  6,2);
521
924
  test_caret('trim', 1,1,  cr+'ab '+cr+'12',  1,1);
522
925
  test_caret('-trim', 6,2, cr+'ab '+cr+'12',  6,2);
523
 
  test_redo('+del(2)',       cr+'ab   12',     6,2);
524
 
  test_undo('-del(2)',    cr+'ab '+cr+'12', 6,2);
 
926
  test_redo_exp('+del(2)',       cr+'ab   12',     6,2);
 
927
  test_undo_exp('-del(2)',    cr+'ab '+cr+'12', 6,2);
525
928
  test_caret('trim(2)', 1,1, cr+'ab '+cr+'12', 1,1);
526
 
  test_redo('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
 
929
  test_redo_exp('+del(3)',       cr+'ab   12',     6,2);  // redo with mis-place caret
527
930
 
528
931
end;
529
932