Mercurial > vim
annotate src/testdir/test_indent.vim @ 27987:250bf98317ea
Added tag v8.2.4518 for changeset c724906134a3ffaef6ec485d6719586b0b06bcb1
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Mar 2022 15:30:06 +0100 |
parents | 748793fcb4e2 |
children | b6f2f545f8cc |
rev | line source |
---|---|
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test for various indent options |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 func Test_preserveindent() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 new |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 " Test for autoindent copying indent from the previous line |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 setlocal autoindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 call setline(1, [repeat(' ', 16) .. 'line1']) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 call feedkeys("A\nline2", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 call assert_equal("\t\tline2", getline(2)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 setlocal autoindent& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 " Test for using CTRL-T with and without 'preserveindent' |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 set shiftwidth=4 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 call cursor(1, 1) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 call setline(1, " \t ") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 call feedkeys("Al\<C-T>", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 call assert_equal("\t\tl", getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 set preserveindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 call setline(1, " \t ") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 call feedkeys("Al\<C-T>", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 call assert_equal(" \t \tl", getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 set pi& sw& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 " Test for using CTRL-T with 'expandtab' and 'preserveindent' |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 call cursor(1, 1) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 call setline(1, "\t \t") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 set shiftwidth=4 expandtab preserveindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 call feedkeys("Al\<C-T>", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 call assert_equal("\t \t l", getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 set sw& et& pi& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 close! |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 " Test for indent() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 func Test_indent_func() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 call assert_equal(-1, indent(-1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 new |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 call setline(1, "\tabc") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 call assert_equal(8, indent(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 call setline(1, " abc") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 call assert_equal(4, indent(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 call setline(1, " \t abc") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 call assert_equal(12, indent(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 close! |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 " Test for reindenting a line using the '=' operator |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 func Test_reindent() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 new |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 call setline(1, 'abc') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 set nomodifiable |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 call assert_fails('normal ==', 'E21:') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 set modifiable |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 call setline(1, ['foo', 'bar']) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 call feedkeys('ggVG=', 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 call assert_equal(['foo', 'bar'], getline(1, 2)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 close! |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 " Test for shifting a line with a preprocessor directive ('#') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 func Test_preproc_indent() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 new |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 set sw=4 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 call setline(1, '#define FOO 1') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 normal >> |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 call assert_equal(' #define FOO 1', getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 " with 'smartindent' |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 call setline(1, '#define FOO 1') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 set smartindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 normal >> |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 call assert_equal('#define FOO 1', getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 set smartindent& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 " with 'cindent' |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 set cindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 normal >> |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 call assert_equal('#define FOO 1', getline(1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 set cindent& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 close! |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 " Test for 'copyindent' |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 func Test_copyindent() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 new |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 set shiftwidth=4 autoindent expandtab copyindent |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 call setline(1, " \t abc") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 call feedkeys("ol", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 call assert_equal(" \t l", getline(2)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 set noexpandtab |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 call setline(1, " \t abc") |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 call feedkeys("ol", 'xt') |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 call assert_equal(" \t l", getline(2)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 set sw& ai& et& ci& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 close! |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 |
19613
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
101 " Test for changing multiple lines with lisp indent |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
102 func Test_lisp_indent_change_multiline() |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
103 new |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
104 setlocal lisp autoindent |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
105 call setline(1, ['(if a', ' (if b', ' (return 5)))']) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
106 normal! jc2j(return 4)) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
107 call assert_equal(' (return 4))', getline(2)) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
108 close! |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
109 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
110 |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
111 func Test_lisp_indent() |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
112 new |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
113 setlocal lisp autoindent |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
114 call setline(1, ['(if a', ' ;; comment', ' \ abc', '', ' " str1\', ' " st\b', ' (return 5)']) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
115 normal! jo;; comment |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
116 normal! jo\ abc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
117 normal! jo;; ret |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
118 normal! jostr1" |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
119 normal! jostr2" |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
120 call assert_equal([' ;; comment', ' ;; comment', ' \ abc', ' \ abc', '', ' ;; ret', ' " str1\', ' str1"', ' " st\b', ' str2"'], getline(2, 11)) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
121 close! |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
122 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
123 |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
124 " Test for setting the 'indentexpr' from a modeline |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
125 func Test_modeline_indent_expr() |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
126 let modeline = &modeline |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
127 set modeline |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
128 func GetIndent() |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
129 return line('.') * 2 |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
130 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
131 call writefile(['# vim: indentexpr=GetIndent()'], 'Xfile.txt') |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
132 set modelineexpr |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
133 new Xfile.txt |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
134 call assert_equal('GetIndent()', &indentexpr) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
135 exe "normal Oa\nb\n" |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
136 call assert_equal([' a', ' b'], getline(1, 2)) |
19719
a659d390d3fd
patch 8.2.0416: test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
137 |
19613
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
138 set modelineexpr& |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
139 delfunc GetIndent |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
140 let &modeline = modeline |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
141 close! |
19719
a659d390d3fd
patch 8.2.0416: test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
142 call delete('Xfile.txt') |
19613
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
143 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
144 |
26167
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
145 func Test_indent_func_with_gq() |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
146 |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
147 function GetTeXIndent() |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
148 " Sample indent expression for TeX files |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
149 let lnum = prevnonblank(v:lnum - 1) |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
150 " At the start of the file use zero indent. |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
151 if lnum == 0 |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
152 return 0 |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
153 endif |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
154 let line = getline(lnum) |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
155 let ind = indent(lnum) |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
156 " Add a 'shiftwidth' after beginning of environments. |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
157 if line =~ '\\begin{center}' |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
158 let ind = ind + shiftwidth() |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
159 endif |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
160 return ind |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
161 endfunction |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
162 |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
163 new |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
164 setl et sw=2 sts=2 ts=2 tw=50 indentexpr=GetTeXIndent() |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
165 put =[ '\documentclass{article}', '', '\begin{document}', '', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
166 \ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ut enim non', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
167 \ 'libero efficitur aliquet. Maecenas metus justo, facilisis convallis blandit', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
168 \ 'non, semper eu urna. Suspendisse diam diam, iaculis faucibus lorem eu,', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
169 \ 'fringilla condimentum lectus. Quisque euismod diam at convallis vulputate.', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
170 \ 'Pellentesque laoreet tortor sit amet mauris euismod ornare. Sed varius', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
171 \ 'bibendum orci vel vehicula. Pellentesque tempor, ipsum et auctor accumsan,', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
172 \ 'metus lectus ultrices odio, sed elementum mi ante at arcu.', '', '\begin{center}', '', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
173 \ 'Proin nec risus consequat nunc dapibus consectetur. Mauris lacinia est a augue', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
174 \ 'tristique accumsan. Morbi pretium, felis molestie eleifend condimentum, arcu', |
26448
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
175 \ 'ipsum congue nisl, quis euismod purus libero in ante.', '', |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
176 \ 'Donec id semper purus.', |
26167
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
177 \ 'Suspendisse eget aliquam nunc. Maecenas fringilla mauris vitae maximus', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
178 \ 'condimentum. Cras a quam in mi dictum eleifend at a lorem. Sed convallis', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
179 \ 'ante a commodo facilisis. Nam suscipit vulputate odio, vel dapibus nisl', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
180 \ 'dignissim facilisis. Vestibulum ante ipsum primis in faucibus orci luctus et', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
181 \ 'ultrices posuere cubilia curae;', '', ''] |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
182 1d_ |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
183 call cursor(5, 1) |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
184 ka |
26448
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
185 call cursor(14, 1) |
26167
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
186 kb |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
187 norm! 'agqap |
26448
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
188 norm! 'bgqG |
26167
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
189 let expected = [ '\documentclass{article}', '', '\begin{document}', '', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
190 \ 'Lorem ipsum dolor sit amet, consectetur adipiscing', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
191 \ 'elit. Fusce ut enim non libero efficitur aliquet.', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
192 \ 'Maecenas metus justo, facilisis convallis blandit', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
193 \ 'non, semper eu urna. Suspendisse diam diam,', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
194 \ 'iaculis faucibus lorem eu, fringilla condimentum', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
195 \ 'lectus. Quisque euismod diam at convallis', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
196 \ 'vulputate. Pellentesque laoreet tortor sit amet', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
197 \ 'mauris euismod ornare. Sed varius bibendum orci', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
198 \ 'vel vehicula. Pellentesque tempor, ipsum et auctor', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
199 \ 'accumsan, metus lectus ultrices odio, sed', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
200 \ 'elementum mi ante at arcu.', '', '\begin{center}', '', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
201 \ ' Proin nec risus consequat nunc dapibus', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
202 \ ' consectetur. Mauris lacinia est a augue', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
203 \ ' tristique accumsan. Morbi pretium, felis', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
204 \ ' molestie eleifend condimentum, arcu ipsum congue', |
26448
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
205 \ ' nisl, quis euismod purus libero in ante.', |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
206 \ '', |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
207 \ ' Donec id semper purus. Suspendisse eget aliquam', |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
208 \ ' nunc. Maecenas fringilla mauris vitae maximus', |
26167
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
209 \ ' condimentum. Cras a quam in mi dictum eleifend', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
210 \ ' at a lorem. Sed convallis ante a commodo', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
211 \ ' facilisis. Nam suscipit vulputate odio, vel', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
212 \ ' dapibus nisl dignissim facilisis. Vestibulum', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
213 \ ' ante ipsum primis in faucibus orci luctus et', |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
214 \ ' ultrices posuere cubilia curae;', '', ''] |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
215 call assert_equal(expected, getline(1, '$')) |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
216 |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
217 bwipe! |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
218 delmark ab |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
219 delfunction GetTeXIndent |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
220 endfu |
7108cee19a2c
patch 8.2.3615: wrong indent in first line if re-formatting with indent expr
Bram Moolenaar <Bram@vim.org>
parents:
19719
diff
changeset
|
221 |
26448
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
222 func Test_formatting_keeps_first_line_indent() |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
223 let lines =<< trim END |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
224 foo() |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
225 { |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
226 int x; // manually positioned |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
227 // more text that will be formatted |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
228 // but not reindented |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
229 END |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
230 new |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
231 call setline(1, lines) |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
232 setlocal sw=4 cindent tw=45 et |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
233 normal! 4Ggqj |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
234 let expected =<< trim END |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
235 foo() |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
236 { |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
237 int x; // manually positioned |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
238 // more text that will be |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
239 // formatted but not |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
240 // reindented |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
241 END |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
242 call assert_equal(expected, getline(1, '$')) |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
243 bwipe! |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
244 endfunc |
748793fcb4e2
patch 8.2.3754: undesired changing of the indent of the first formatted line
Bram Moolenaar <Bram@vim.org>
parents:
26167
diff
changeset
|
245 |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 " vim: shiftwidth=2 sts=2 expandtab |