annotate src/testdir/test_cdo.vim @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Oct 2019 04:30:05 +0100
parents 0da9bc55c31a
children e373843e2980
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for the :cdo, :cfdo, :ldo and :lfdo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
3 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
4 CheckFeature quickfix
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Create the files used by the tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 function SetUp()
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " Remove the files used by the tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 function TearDown()
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call delete('Xtestfile1')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call delete('Xtestfile2')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call delete('Xtestfile3')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " Returns the current line in '<filename> <linenum>L <column>C' format
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 function GetRuler()
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " Tests for the :cdo and :ldo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 function XdoTests(cchar)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " Shortcuts for calling the cdo and ldo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let Xdo = a:cchar . 'do'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let Xgetexpr = a:cchar . 'getexpr'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let Xprev = a:cchar. 'prev'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 let XdoCmd = Xdo . ' call add(l, GetRuler())'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Try with an empty list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " Populate the list and then try
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " Run command only on selected error lines
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exe "2,3" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " Boundary condition tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 exe "1,1" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal(['Xtestfile1 1L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 exe "3" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " Range test commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 exe "%" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 exe "1,$" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 exe Xprev
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 exe "." . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 exe "+" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " Invalid error lines test
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 exe "silent! 27" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 exe "silent! 4,5" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " Run commands from an unsaved buffer
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let v:errmsg=''
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 setlocal modified
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 exe "silent! 2,2" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 if v:errmsg !~# 'No write since last change'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call add(v:errors, 'Unsaved file change test failed')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endif
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " If the executed command fails, then the operation should be aborted
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 enew!
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 let subst_count = 0
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 if subst_count != 1 || getline('.') != 'xLine1'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call add(v:errors, 'Abort command on error test failed')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 endif
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 exe "2,2" . Xdo . "! call add(l, GetRuler())"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 " List with no valid error entries
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 edit! +2 Xtestfile1
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 exe "silent! 2" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 let v:errmsg=''
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 exe "%" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 exe "1,$" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 exe "." . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal('', v:errmsg)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 " List with only one valid entry
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 exe Xgetexpr . " ['Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 " Tests for the :cfdo and :lfdo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 function XfdoTests(cchar)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " Shortcuts for calling the cfdo and lfdo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 let Xfdo = a:cchar . 'fdo'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let Xgetexpr = a:cchar . 'getexpr'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 let XfdoCmd = Xfdo . ' call add(l, GetRuler())'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 let Xpfile = a:cchar. 'pfile'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 " Clear the quickfix/location list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 exe Xgetexpr . " []"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " Try with an empty list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 " Populate the list and then try
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 " Run command only on selected error lines
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 exe "2,3" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " Boundary condition tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 exe "3" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 call assert_equal(['Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 " Range test commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 exe "%" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 exe "1,$" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 exe Xpfile
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 exe "." . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 " List with only one valid entry
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 exe Xgetexpr . " ['Xtestfile2:2:5:Line2']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 call assert_equal(['Xtestfile2 2L 5C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 " Tests for cdo and cfdo
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 function Test_cdo()
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call XdoTests('c')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 call XfdoTests('c')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 endfunction
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 " Tests for ldo and lfdo
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 function Test_ldo()
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 call XdoTests('l')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call XfdoTests('l')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 endfunction