blob: 5e0f86ad66d3c724c73d05a99d13c0235f030df7 [file] [log] [blame]
Bram Moolenaar62706602016-12-09 19:28:48 +01001" Test for displaying stuff
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +02002
Bram Moolenaar62706602016-12-09 19:28:48 +01003if !has('gui_running') && has('unix')
4 set term=ansi
5endif
6
Bram Moolenaarc6cd8402017-03-29 14:40:47 +02007source view_util.vim
Bram Moolenaar3c8ee622019-08-03 22:55:50 +02008source check.vim
9source screendump.vim
Bram Moolenaar62706602016-12-09 19:28:48 +010010
Bram Moolenaar1e115362019-01-09 23:01:02 +010011func Test_display_foldcolumn()
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020012 CheckFeature folding
13
Bram Moolenaar62706602016-12-09 19:28:48 +010014 new
15 vnew
16 vert resize 25
Bram Moolenaar70892372016-12-09 19:51:49 +010017 call assert_equal(25, winwidth(winnr()))
18 set isprint=@
Bram Moolenaar62706602016-12-09 19:28:48 +010019
20 1put='e more noise blah blah‚ more stuff here'
21
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020022 let expect = [
23 \ "e more noise blah blah<82",
24 \ "> more stuff here "
25 \ ]
Bram Moolenaar62706602016-12-09 19:28:48 +010026
27 call cursor(2, 1)
28 norm! zt
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020029 let lines = ScreenLines([1,2], winwidth(0))
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020030 call assert_equal(expect, lines)
Bram Moolenaar62706602016-12-09 19:28:48 +010031 set fdc=2
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020032 let lines = ScreenLines([1,2], winwidth(0))
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020033 let expect = [
34 \ " e more noise blah blah<",
35 \ " 82> more stuff here "
36 \ ]
37 call assert_equal(expect, lines)
Bram Moolenaar62706602016-12-09 19:28:48 +010038
39 quit!
40 quit!
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020041endfunc
42
Bram Moolenaar1e115362019-01-09 23:01:02 +010043func Test_display_foldtext_mbyte()
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020044 CheckFeature folding
45
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020046 call NewWindow(10, 40)
47 call append(0, range(1,20))
48 exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2"
49 call cursor(2, 1)
50 norm! zf13G
51 let lines=ScreenLines([1,3], winwidth(0)+1)
52 let expect=[
53 \ " 1 \u2502",
54 \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502",
55 \ " 14 \u2502",
56 \ ]
57 call assert_equal(expect, lines)
Bram Moolenaar8da1e6c2017-03-29 20:38:59 +020058
59 set fillchars=fold:-,vert:\|
60 let lines=ScreenLines([1,3], winwidth(0)+1)
61 let expect=[
62 \ " 1 |",
63 \ "+ +-- 12 lines: 2". repeat("-", 23). "|",
64 \ " 14 |",
65 \ ]
66 call assert_equal(expect, lines)
67
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020068 set foldtext& fillchars& foldmethod& fdc&
69 bw!
70endfunc
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020071
72" check that win_ins_lines() and win_del_lines() work when t_cs is empty.
73func Test_scroll_without_region()
74 CheckScreendump
75
76 let lines =<< trim END
77 call setline(1, range(1, 20))
78 set t_cs=
79 set laststatus=2
80 END
Bram Moolenaar59173412022-09-20 22:01:33 +010081 call writefile(lines, 'Xtestscroll', 'D')
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020082 let buf = RunVimInTerminal('-S Xtestscroll', #{rows: 10})
83
84 call VerifyScreenDump(buf, 'Test_scroll_no_region_1', {})
85
86 call term_sendkeys(buf, ":3delete\<cr>")
87 call VerifyScreenDump(buf, 'Test_scroll_no_region_2', {})
88
89 call term_sendkeys(buf, ":4put\<cr>")
90 call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {})
91
Bram Moolenaar7cc53512019-08-03 23:30:21 +020092 call term_sendkeys(buf, ":undo\<cr>")
93 call term_sendkeys(buf, ":undo\<cr>")
94 call term_sendkeys(buf, ":set laststatus=0\<cr>")
95 call VerifyScreenDump(buf, 'Test_scroll_no_region_4', {})
96
97 call term_sendkeys(buf, ":3delete\<cr>")
98 call VerifyScreenDump(buf, 'Test_scroll_no_region_5', {})
99
100 call term_sendkeys(buf, ":4put\<cr>")
101 call VerifyScreenDump(buf, 'Test_scroll_no_region_6', {})
102
Bram Moolenaar3c8ee622019-08-03 22:55:50 +0200103 " clean up
104 call StopVimInTerminal(buf)
Bram Moolenaar3c8ee622019-08-03 22:55:50 +0200105endfunc
Bram Moolenaarbffba7f2019-09-20 17:00:17 +0200106
107func Test_display_listchars_precedes()
108 call NewWindow(10, 10)
109 " Need a physical line that wraps over the complete
110 " window size
111 call append(0, repeat('aaa aaa aa ', 10))
112 call append(1, repeat(['bbb bbb bbb bbb'], 2))
113 " remove blank trailing line
114 $d
115 set list nowrap
116 call cursor(1, 1)
117 " move to end of line and scroll 2 characters back
118 norm! $2zh
119 let lines=ScreenLines([1,4], winwidth(0)+1)
120 let expect = [
121 \ " aaa aa $ |",
122 \ "$ |",
123 \ "$ |",
124 \ "~ |",
125 \ ]
126 call assert_equal(expect, lines)
127 set list listchars+=precedes:< nowrap
128 call cursor(1, 1)
129 " move to end of line and scroll 2 characters back
130 norm! $2zh
131 let lines = ScreenLines([1,4], winwidth(0)+1)
132 let expect = [
133 \ "<aaa aa $ |",
134 \ "< |",
135 \ "< |",
136 \ "~ |",
137 \ ]
138 call assert_equal(expect, lines)
139 set wrap
140 call cursor(1, 1)
141 " the complete line should be displayed in the window
142 norm! $
143
144 let lines = ScreenLines([1,10], winwidth(0)+1)
145 let expect = [
Bram Moolenaar297164c2022-10-15 14:24:29 +0100146 \ "<aaa aaa a|",
Bram Moolenaarbffba7f2019-09-20 17:00:17 +0200147 \ "a aaa aaa |",
148 \ "aa aaa aaa|",
149 \ " aa aaa aa|",
150 \ "a aa aaa a|",
151 \ "aa aa aaa |",
152 \ "aaa aa aaa|",
153 \ " aaa aa aa|",
154 \ "a aaa aa a|",
155 \ "aa aaa aa |",
156 \ ]
157 call assert_equal(expect, lines)
158 set list& listchars& wrap&
159 bw!
160endfunc
Bram Moolenaar28686682019-10-24 15:12:37 +0200161
162" Check that win_lines() works correctly with the number_only parameter=TRUE
163" should break early to optimize cost of drawing, but needs to make sure
164" that the number column is correctly highlighted.
165func Test_scroll_CursorLineNr_update()
166 CheckScreendump
167
168 let lines =<< trim END
169 hi CursorLineNr ctermfg=73 ctermbg=236
170 set nu rnu cursorline cursorlineopt=number
171 exe ":norm! o\<esc>110ia\<esc>"
172 END
173 let filename = 'Xdrawscreen'
Bram Moolenaar59173412022-09-20 22:01:33 +0100174 call writefile(lines, filename, 'D')
Bram Moolenaar28686682019-10-24 15:12:37 +0200175 let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50})
176 call term_sendkeys(buf, "k")
Bram Moolenaar28686682019-10-24 15:12:37 +0200177 call VerifyScreenDump(buf, 'Test_winline_rnu', {})
178
179 " clean up
180 call StopVimInTerminal(buf)
Bram Moolenaar28686682019-10-24 15:12:37 +0200181endfunc
Bram Moolenaar0efd1bd2019-12-11 19:00:04 +0100182
183" check a long file name does not result in the hit-enter prompt
184func Test_edit_long_file_name()
185 CheckScreendump
186
Bram Moolenaar6e43b302019-12-14 17:53:27 +0100187 let longName = 'x'->repeat(min([&columns, 255]))
Bram Moolenaar59173412022-09-20 22:01:33 +0100188 call writefile([], longName, 'D')
Bram Moolenaar0efd1bd2019-12-11 19:00:04 +0100189 let buf = RunVimInTerminal('-N -u NONE ' .. longName, #{rows: 8})
190
191 call VerifyScreenDump(buf, 'Test_long_file_name_1', {})
192
Bram Moolenaar0efd1bd2019-12-11 19:00:04 +0100193 " clean up
194 call StopVimInTerminal(buf)
Bram Moolenaar0efd1bd2019-12-11 19:00:04 +0100195endfunc
196
Bram Moolenaar32ee6272020-06-10 14:16:49 +0200197func Test_unprintable_fileformats()
198 CheckScreendump
199
Bram Moolenaar59173412022-09-20 22:01:33 +0100200 call writefile(["unix\r", "two"], 'Xunix.txt', 'D')
201 call writefile(["mac\r", "two"], 'Xmac.txt', 'D')
Bram Moolenaar32ee6272020-06-10 14:16:49 +0200202 let lines =<< trim END
203 edit Xunix.txt
204 split Xmac.txt
205 edit ++ff=mac
206 END
207 let filename = 'Xunprintable'
Bram Moolenaar59173412022-09-20 22:01:33 +0100208 call writefile(lines, filename, 'D')
Bram Moolenaar32ee6272020-06-10 14:16:49 +0200209 let buf = RunVimInTerminal('-S '.filename, #{rows: 9, cols: 50})
210 call VerifyScreenDump(buf, 'Test_display_unprintable_01', {})
211 call term_sendkeys(buf, "\<C-W>\<C-W>\<C-L>")
212 call VerifyScreenDump(buf, 'Test_display_unprintable_02', {})
213
214 " clean up
215 call StopVimInTerminal(buf)
Bram Moolenaar32ee6272020-06-10 14:16:49 +0200216endfunc
Bram Moolenaarf8992d42020-08-01 19:14:13 +0200217
Bram Moolenaar9dc19172020-08-19 20:19:48 +0200218func Test_display_scroll_at_topline()
219 CheckScreendump
220
221 let buf = RunVimInTerminal('', #{cols: 20})
222 call term_sendkeys(buf, ":call setline(1, repeat('a', 21))\<CR>")
Bram Moolenaar733d2592020-08-20 18:59:06 +0200223 call TermWait(buf)
Bram Moolenaar9dc19172020-08-19 20:19:48 +0200224 call term_sendkeys(buf, "O\<Esc>")
225 call VerifyScreenDump(buf, 'Test_display_scroll_at_topline', #{rows: 4})
226
227 call StopVimInTerminal(buf)
228endfunc
229
Bram Moolenaarabb6fbd2022-03-25 15:42:27 +0000230func Test_display_scroll_update_visual()
231 CheckScreendump
232
233 let lines =<< trim END
234 set scrolloff=0
235 call setline(1, repeat(['foo'], 10))
236 call sign_define('foo', { 'text': '>' })
237 call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 })
238 call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 })
239 autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif
240 END
Bram Moolenaar59173412022-09-20 22:01:33 +0100241 call writefile(lines, 'XupdateVisual.vim', 'D')
Bram Moolenaarabb6fbd2022-03-25 15:42:27 +0000242
243 let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60})
244 call term_sendkeys(buf, "VG7kk")
245 call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {})
246
247 call StopVimInTerminal(buf)
Bram Moolenaarabb6fbd2022-03-25 15:42:27 +0000248endfunc
249
Bram Moolenaara98f8a22021-02-13 18:24:23 +0100250" Test for 'eob' (EndOfBuffer) item in 'fillchars'
251func Test_eob_fillchars()
252 " default value
253 call assert_match('eob:\~', &fillchars)
254 " invalid values
255 call assert_fails(':set fillchars=eob:', 'E474:')
256 call assert_fails(':set fillchars=eob:xy', 'E474:')
257 call assert_fails(':set fillchars=eob:\255', 'E474:')
258 call assert_fails(':set fillchars=eob:<ff>', 'E474:')
zeertzjq60618c82021-12-18 15:32:46 +0000259 call assert_fails(":set fillchars=eob:\x01", 'E474:')
260 call assert_fails(':set fillchars=eob:\\x01', 'E474:')
Bram Moolenaara98f8a22021-02-13 18:24:23 +0100261 " default is ~
262 new
Bram Moolenaar2cec0272021-03-22 17:30:47 +0100263 redraw
Bram Moolenaara98f8a22021-02-13 18:24:23 +0100264 call assert_equal('~', Screenline(2))
265 set fillchars=eob:+
Bram Moolenaar2cec0272021-03-22 17:30:47 +0100266 redraw
Bram Moolenaara98f8a22021-02-13 18:24:23 +0100267 call assert_equal('+', Screenline(2))
268 set fillchars=eob:\
Bram Moolenaar2cec0272021-03-22 17:30:47 +0100269 redraw
Bram Moolenaara98f8a22021-02-13 18:24:23 +0100270 call assert_equal(' ', nr2char(screenchar(2, 1)))
271 set fillchars&
272 close
273endfunc
274
Bram Moolenaar3aca5a62021-02-17 13:14:07 +0100275" Test for 'foldopen', 'foldclose' and 'foldsep' in 'fillchars'
276func Test_fold_fillchars()
277 new
278 set fdc=2 foldenable foldmethod=manual
279 call setline(1, ['one', 'two', 'three', 'four', 'five'])
280 2,4fold
281 " First check for the default setting for a closed fold
282 let lines = ScreenLines([1, 3], 8)
283 let expected = [
284 \ ' one ',
285 \ '+ +-- 3',
286 \ ' five '
287 \ ]
288 call assert_equal(expected, lines)
289 normal 2Gzo
290 " check the characters for an open fold
291 let lines = ScreenLines([1, 5], 8)
292 let expected = [
293 \ ' one ',
294 \ '- two ',
295 \ '| three ',
296 \ '| four ',
297 \ ' five '
298 \ ]
299 call assert_equal(expected, lines)
300
301 " change the setting
302 set fillchars=vert:\|,fold:-,eob:~,foldopen:[,foldclose:],foldsep:-
303
304 " check the characters for an open fold
305 let lines = ScreenLines([1, 5], 8)
306 let expected = [
307 \ ' one ',
308 \ '[ two ',
309 \ '- three ',
310 \ '- four ',
311 \ ' five '
312 \ ]
313 call assert_equal(expected, lines)
314
315 " check the characters for a closed fold
316 normal 2Gzc
317 let lines = ScreenLines([1, 3], 8)
318 let expected = [
319 \ ' one ',
320 \ '] +-- 3',
321 \ ' five '
322 \ ]
323 call assert_equal(expected, lines)
324
325 %bw!
326 set fillchars& fdc& foldmethod& foldenable&
327endfunc
328
Bram Moolenaar96ba25a2022-07-04 17:34:33 +0100329func Test_local_fillchars()
330 CheckScreendump
331
332 let lines =<< trim END
333 call setline(1, ['window 1']->repeat(3))
334 setlocal fillchars=stl:1,stlnc:a,vert:=,eob:x
335 vnew
336 call setline(1, ['window 2']->repeat(3))
337 setlocal fillchars=stl:2,stlnc:b,vert:+,eob:y
338 new
339 wincmd J
340 call setline(1, ['window 3']->repeat(3))
341 setlocal fillchars=stl:3,stlnc:c,vert:<,eob:z
342 vnew
343 call setline(1, ['window 4']->repeat(3))
344 setlocal fillchars=stl:4,stlnc:d,vert:>,eob:o
345 END
Bram Moolenaar59173412022-09-20 22:01:33 +0100346 call writefile(lines, 'Xdisplayfillchars', 'D')
Bram Moolenaar96ba25a2022-07-04 17:34:33 +0100347 let buf = RunVimInTerminal('-S Xdisplayfillchars', #{rows: 12})
348 call VerifyScreenDump(buf, 'Test_display_fillchars_1', {})
349
350 call term_sendkeys(buf, ":wincmd k\r")
351 call VerifyScreenDump(buf, 'Test_display_fillchars_2', {})
352
353 call StopVimInTerminal(buf)
Bram Moolenaar96ba25a2022-07-04 17:34:33 +0100354endfunc
355
Bram Moolenaara06e3452021-05-29 17:56:37 +0200356func Test_display_linebreak_breakat()
357 new
358 vert resize 25
359 let _breakat = &breakat
zeertzjq1d3e0e82023-08-28 21:20:16 +0200360 setl signcolumn=yes linebreak breakat=) showbreak=++
Bram Moolenaara06e3452021-05-29 17:56:37 +0200361 call setline(1, repeat('x', winwidth(0) - 2) .. ')abc')
362 let lines = ScreenLines([1, 2], 25)
363 let expected = [
364 \ ' xxxxxxxxxxxxxxxxxxxxxxx',
zeertzjq1d3e0e82023-08-28 21:20:16 +0200365 \ ' ++)abc ',
366 \ ]
367 call assert_equal(expected, lines)
368 setl breakindent breakindentopt=shift:2
369 let lines = ScreenLines([1, 2], 25)
370 let expected = [
371 \ ' xxxxxxxxxxxxxxxxxxxxxxx',
372 \ ' ++)abc ',
Bram Moolenaara06e3452021-05-29 17:56:37 +0200373 \ ]
374 call assert_equal(expected, lines)
375 %bw!
376 let &breakat=_breakat
377endfunc
378
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100379func Run_Test_display_lastline(euro)
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100380 let lines =<< trim END
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100381 call setline(1, ['aaa', 'b'->repeat(200)])
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100382 set display=truncate
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100383
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100384 vsplit
385 100wincmd <
386 END
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100387 if a:euro != ''
388 let lines[2] = 'set fillchars=vert:\|,lastline:€'
389 endif
Bram Moolenaar59173412022-09-20 22:01:33 +0100390 call writefile(lines, 'XdispLastline', 'D')
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100391 let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10})
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100392 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}1', {})
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100393
394 call term_sendkeys(buf, ":set display=lastline\<CR>")
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100395 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}2', {})
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100396
397 call term_sendkeys(buf, ":100wincmd >\<CR>")
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100398 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}3', {})
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100399
400 call term_sendkeys(buf, ":set display=truncate\<CR>")
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100401 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}4', {})
402
403 call term_sendkeys(buf, ":close\<CR>")
404 call term_sendkeys(buf, ":3split\<CR>")
405 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}5', {})
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100406
zeertzjq18b35002022-10-04 20:35:37 +0100407 call term_sendkeys(buf, ":close\<CR>")
408 call term_sendkeys(buf, ":2vsplit\<CR>")
409 call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}6', {})
410
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100411 call StopVimInTerminal(buf)
Bram Moolenaarcee9c842022-04-09 12:40:13 +0100412endfunc
413
Bram Moolenaar4ba5f1d2022-10-04 14:36:29 +0100414func Test_display_lastline()
415 CheckScreendump
416
417 call Run_Test_display_lastline('')
418 call Run_Test_display_lastline('euro_')
419
420 call assert_fails(':set fillchars=lastline:', 'E474:')
421 call assert_fails(':set fillchars=lastline:〇', 'E474:')
422endfunc
423
Luuk van Baal5b10a142023-04-30 19:15:30 +0100424func Test_display_long_lastline()
425 CheckScreendump
426
427 let lines =<< trim END
Luuk van Baal5d01f862023-05-11 19:24:20 +0100428 set display=lastline smoothscroll scrolloff=0
Luuk van Baal5b10a142023-04-30 19:15:30 +0100429 call setline(1, [
Luuk van Baal5d01f862023-05-11 19:24:20 +0100430 \'aaaaa'->repeat(150),
Luuk van Baal5b10a142023-04-30 19:15:30 +0100431 \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7)
432 \])
433 END
434
435 call writefile(lines, 'XdispLongline', 'D')
436 let buf = RunVimInTerminal('-S XdispLongline', #{rows: 14, cols: 35})
437
Luuk van Baal5d01f862023-05-11 19:24:20 +0100438 call term_sendkeys(buf, "736|")
Luuk van Baal5b10a142023-04-30 19:15:30 +0100439 call VerifyScreenDump(buf, 'Test_display_long_line_1', {})
Luuk van Baal5d01f862023-05-11 19:24:20 +0100440
441 " The correct part of the last line is moved into view.
Luuk van Baal5b10a142023-04-30 19:15:30 +0100442 call term_sendkeys(buf, "D")
443 call VerifyScreenDump(buf, 'Test_display_long_line_2', {})
444
Luuk van Baal5d01f862023-05-11 19:24:20 +0100445 " "w_skipcol" does not change because the topline is still long enough
446 " to maintain the current skipcol.
447 call term_sendkeys(buf, "g04l11gkD")
448 call VerifyScreenDump(buf, 'Test_display_long_line_3', {})
449
450 " "w_skipcol" is reset to bring the entire topline into view because
451 " the line length is now smaller than the current skipcol + marker.
452 call term_sendkeys(buf, "x")
453 call VerifyScreenDump(buf, 'Test_display_long_line_4', {})
454
Luuk van Baal5b10a142023-04-30 19:15:30 +0100455 call StopVimInTerminal(buf)
456endfunc
Bram Moolenaara06e3452021-05-29 17:56:37 +0200457
Luuk van Baal6c018682023-05-11 18:38:14 +0100458" Moving the cursor to a line that doesn't fit in the window should show
459" correctly.
460func Test_display_cursor_long_line()
461 CheckScreendump
462
463 let lines =<< trim END
Luuk van Baal798fa762023-05-15 18:17:43 +0100464 call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c'])
Luuk van Baal6c018682023-05-11 18:38:14 +0100465 norm $j
466 END
467
468 call writefile(lines, 'XdispCursorLongline', 'D')
469 let buf = RunVimInTerminal('-S XdispCursorLongline', #{rows: 8})
470
Luuk van Baal798fa762023-05-15 18:17:43 +0100471 call VerifyScreenDump(buf, 'Test_display_cursor_long_line_1', {})
472
473 " FIXME: moving the cursor above the topline does not set w_skipcol
474 " correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1).
475 call term_sendkeys(buf, ":set number cpo+=n scrolloff=0\<CR>")
476 call term_sendkeys(buf, '$0')
477 call VerifyScreenDump(buf, 'Test_display_cursor_long_line_2', {})
478
479 " Going to the start of the line with "b" did not set w_skipcol correctly
480 " with 'smoothscroll'.
481 call term_sendkeys(buf, ":set smoothscroll\<CR>")
482 call term_sendkeys(buf, '$b')
483 call VerifyScreenDump(buf, 'Test_display_cursor_long_line_3', {})
484 " Same for "ge".
485 call term_sendkeys(buf, '$ge')
486 call VerifyScreenDump(buf, 'Test_display_cursor_long_line_4', {})
Luuk van Baal6c018682023-05-11 18:38:14 +0100487
488 call StopVimInTerminal(buf)
489endfunc
490
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +0200491" vim: shiftwidth=2 sts=2 expandtab