Mercurial > vim
annotate src/testdir/test_shift.vim @ 28743:cf6bba7a9b0f v8.2.4896
patch 8.2.4896: expression in command block does not look after NL
Commit: https://github.com/vim/vim/commit/a13e7acba9928a9c5e97be28946418d8d4323988
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 6 21:24:31 2022 +0100
patch 8.2.4896: expression in command block does not look after NL
Problem: Expression in command block does not look after NL when command is
typed.
Solution: Skip over NL also when not in a script. (closes #10358)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 06 May 2022 22:30:02 +0200 |
parents | 08940efa6b4e |
children |
rev | line source |
---|---|
17688
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test shifting lines with :> and :< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 source check.vim |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 func Test_ex_shift_right() |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 set shiftwidth=2 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 " shift right current line. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 call setline(1, range(1, 5)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 2 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 > |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 3 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 >> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 call assert_equal(['1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 \ '4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 \ '5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 " shift right with range. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 call setline(1, range(1, 4)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 2,3>> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 call assert_equal(['1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 \ '4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 \ '5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 " shift right with range and count. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 call setline(1, range(1, 4)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 2>3 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 call assert_equal(['1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 \ ' 4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 \ '5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 bw! |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 set shiftwidth& |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 endfunc |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 func Test_ex_shift_left() |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 set shiftwidth=2 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 call setline(1, range(1, 5)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 %>>> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 " left shift current line. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 2< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 3<< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 4<<<<< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 call assert_equal([' 1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 \ '4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 \ ' 5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 " shift right with range. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 call setline(1, range(1, 5)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 %>>> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 2,3<< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 call assert_equal([' 1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 \ ' 4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 \ ' 5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 " shift right with range and count. |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 call setline(1, range(1, 5)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 %>>> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 2<<3 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 call assert_equal([' 1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 \ ' 4', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 \ ' 5'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 bw! |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 set shiftwidth& |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 endfunc |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 func Test_ex_shift_rightleft() |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 CheckFeature rightleft |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 set shiftwidth=2 rightleft |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 call setline(1, range(1, 4)) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 2,3<< |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 call assert_equal(['1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 \ '4'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 3,4> |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 call assert_equal(['1', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 \ ' 2', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 \ ' 3', |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 \ '4'], getline(1, '$')) |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 bw! |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 set rightleft& shiftwidth& |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 endfunc |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 func Test_ex_shift_errors() |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call assert_fails('><', 'E488:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 call assert_fails('<>', 'E488:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 call assert_fails('>!', 'E477:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 call assert_fails('<!', 'E477:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 call assert_fails('2,1>', 'E493:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 call assert_fails('2,1<', 'E493:') |
c945f1d03b1c
patch 8.1.1841: no test for Ex shift commands
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
17688
diff
changeset
|
114 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
17688
diff
changeset
|
115 " vim: shiftwidth=2 sts=2 expandtab |