comparison src/testdir/test_conceal.vim @ 18870:1895dd434ecf v8.1.2421

patch 8.1.2421: test88 is old style Commit: https://github.com/vim/vim/commit/213ed008bbcd9fe0d3329b17f5f4af0169e448ff Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 11 20:12:26 2019 +0100 patch 8.1.2421: test88 is old style Problem: Test88 is old style. Solution: Turn into a new style test. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5347)
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 Dec 2019 20:15:04 +0100
parents 5f1554b2587c
children c087099e9163
comparison
equal deleted inserted replaced
18869:6663d5342062 18870:1895dd434ecf
1 " Tests for 'conceal'. 1 " Tests for 'conceal'.
2 " Also see test88.in (should be converted to a test function here).
3 2
4 source check.vim 3 source check.vim
5 CheckFeature conceal 4 CheckFeature conceal
6 5
7 source screendump.vim 6 source screendump.vim
153 152
154 " clean up 153 " clean up
155 call StopVimInTerminal(buf) 154 call StopVimInTerminal(buf)
156 call delete('XTest_conceal_resize') 155 call delete('XTest_conceal_resize')
157 endfunc 156 endfunc
157
158 " Tests for correct display (cursor column position) with +conceal and
159 " tabulators. Need to run this test in a separate Vim instance. Otherwise the
160 " screen is not updated (lazy redraw) and the cursor position is wrong.
161 func Test_conceal_cursor_pos()
162 let code =<< trim [CODE]
163 :let l = ['start:', '.concealed. text', "|concealed|\ttext"]
164 :let l += ['', "\t.concealed.\ttext", "\t|concealed|\ttext", '']
165 :let l += [".a.\t.b.\t.c.\t.d.", "|a|\t|b|\t|c|\t|d|"]
166 :call append(0, l)
167 :call cursor(1, 1)
168 :" Conceal settings.
169 :set conceallevel=2
170 :set concealcursor=nc
171 :syntax match test /|/ conceal
172 :" Save current cursor position. Only works in <expr> mode, can't be used
173 :" with :normal because it moves the cursor to the command line. Thanks
174 :" to ZyX <zyx.vim@gmail.com> for the idea to use an <expr> mapping.
175 :let curpos = []
176 :nnoremap <expr> GG ":let curpos += ['".screenrow().":".screencol()."']\n"
177 :normal ztj
178 GGk
179 :" We should end up in the same column when running these commands on the
180 :" two lines.
181 :normal ft
182 GGk
183 :normal $
184 GGk
185 :normal 0j
186 GGk
187 :normal ft
188 GGk
189 :normal $
190 GGk
191 :normal 0j0j
192 GGk
193 :" Same for next test block.
194 :normal ft
195 GGk
196 :normal $
197 GGk
198 :normal 0j
199 GGk
200 :normal ft
201 GGk
202 :normal $
203 GGk
204 :normal 0j0j
205 GGk
206 :" And check W with multiple tabs and conceals in a line.
207 :normal W
208 GGk
209 :normal W
210 GGk
211 :normal W
212 GGk
213 :normal $
214 GGk
215 :normal 0j
216 GGk
217 :normal W
218 GGk
219 :normal W
220 GGk
221 :normal W
222 GGk
223 :normal $
224 GGk
225 :set lbr
226 :normal $
227 GGk
228 :set list listchars=tab:>-
229 :normal 0
230 GGk
231 :normal W
232 GGk
233 :normal W
234 GGk
235 :normal W
236 GGk
237 :normal $
238 GGk
239 :call writefile(curpos, 'Xconceal_curpos.out')
240 :q!
241
242 [CODE]
243 call writefile(code, 'XTest_conceal_curpos')
244
245 if RunVim([], [], '-s XTest_conceal_curpos')
246 call assert_equal([
247 \ '2:1', '2:17', '2:20', '3:1', '3:17', '3:20', '5:8', '5:25',
248 \ '5:28', '6:8', '6:25', '6:28', '8:1', '8:9', '8:17', '8:25',
249 \ '8:27', '9:1', '9:9', '9:17', '9:25', '9:26', '9:26', '9:1',
250 \ '9:9', '9:17', '9:25', '9:26'], readfile('Xconceal_curpos.out'))
251 endif
252
253 call delete('Xconceal_curpos.out')
254 call delete('XTest_conceal_curpos')
255 endfunc
256
257 " vim: shiftwidth=2 sts=2 expandtab