robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
22.0 KiB717 linesraw
1" Test for displaying stuff
2
3" Nvim: `:set term` is not supported.
4" if !has('gui_running') && has('unix')
5"   set term=ansi
6" endif
7
8source view_util.vim
9source check.vim
10source screendump.vim
11
12func Test_display_foldcolumn()
13  CheckFeature folding
14
15  new
16  vnew
17  vert resize 25
18  call assert_equal(25, winwidth(winnr()))
19  " does not affect test behavior, <82> is unprintable by default:
20  " set isprint=@
21
22  1put='e more noise blah blah‚ more stuff here'
23
24  let expect = [
25        \ "e more noise blah blah<82",
26        \ "> more stuff here        "
27        \ ]
28
29  call cursor(2, 1)
30  norm! zt
31  let lines = ScreenLines([1,2], winwidth(0))
32  call assert_equal(expect, lines)
33  set fdc=2
34  let lines = ScreenLines([1,2], winwidth(0))
35  let expect = [
36        \ "  e more noise blah blah<",
37        \ "  82> more stuff here    "
38        \ ]
39  call assert_equal(expect, lines)
40
41  quit!
42  quit!
43endfunc
44
45func Test_display_foldtext_mbyte()
46  CheckFeature folding
47
48  call NewWindow(10, 40)
49  call append(0, range(1,20))
50  exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2"
51  call cursor(2, 1)
52  norm! zf13G
53  let lines=ScreenLines([1,3], winwidth(0)+1)
54  let expect=[
55        \ "  1                                     \u2502",
56        \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502",
57        \ "  14                                    \u2502",
58        \ ]
59  call assert_equal(expect, lines)
60
61  set fillchars=fold:-,vert:\|
62  let lines=ScreenLines([1,3], winwidth(0)+1)
63  let expect=[
64        \ "  1                                     |",
65        \ "+ +-- 12 lines: 2". repeat("-", 23). "|",
66        \ "  14                                    |",
67        \ ]
68  call assert_equal(expect, lines)
69
70  set foldtext& fillchars& foldmethod& fdc&
71  bw!
72endfunc
73
74" check that win_ins_lines() and win_del_lines() work when t_cs is empty.
75func Test_scroll_without_region()
76  CheckScreendump
77
78  let lines =<< trim END
79    call setline(1, range(1, 20))
80    set t_cs=
81    set laststatus=2
82  END
83  call writefile(lines, 'Xtestscroll', 'D')
84  let buf = RunVimInTerminal('-S Xtestscroll', #{rows: 10})
85
86  call VerifyScreenDump(buf, 'Test_scroll_no_region_1', {})
87
88  call term_sendkeys(buf, ":3delete\<cr>")
89  call VerifyScreenDump(buf, 'Test_scroll_no_region_2', {})
90
91  call term_sendkeys(buf, ":4put\<cr>")
92  call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {})
93
94  call term_sendkeys(buf, ":undo\<cr>")
95  call term_sendkeys(buf, ":undo\<cr>")
96  call term_sendkeys(buf, ":set laststatus=0\<cr>")
97  call VerifyScreenDump(buf, 'Test_scroll_no_region_4', {})
98
99  call term_sendkeys(buf, ":3delete\<cr>")
100  call VerifyScreenDump(buf, 'Test_scroll_no_region_5', {})
101
102  call term_sendkeys(buf, ":4put\<cr>")
103  call VerifyScreenDump(buf, 'Test_scroll_no_region_6', {})
104
105  " clean up
106  call StopVimInTerminal(buf)
107endfunc
108
109func Test_display_listchars_precedes()
110  call NewWindow(10, 10)
111  " Need a physical line that wraps over the complete
112  " window size
113  call append(0, repeat('aaa aaa aa ', 10))
114  call append(1, repeat(['bbb bbb bbb bbb'], 2))
115  " remove blank trailing line
116  $d
117  set list nowrap
118  call cursor(1, 1)
119  " move to end of line and scroll 2 characters back
120  norm! $2zh
121  let lines=ScreenLines([1,4], winwidth(0)+1)
122  let expect = [
123        \ " aaa aa $ |",
124        \ "$         |",
125        \ "$         |",
126        \ "~         |",
127        \ ]
128  call assert_equal(expect, lines)
129  set list listchars+=precedes:< nowrap
130  call cursor(1, 1)
131  " move to end of line and scroll 2 characters back
132  norm! $2zh
133  let lines = ScreenLines([1,4], winwidth(0)+1)
134  let expect = [
135        \ "<aaa aa $ |",
136        \ "<         |",
137        \ "<         |",
138        \ "~         |",
139        \ ]
140  call assert_equal(expect, lines)
141  set wrap
142  call cursor(1, 1)
143  " the complete line should be displayed in the window
144  norm! $
145
146  let lines = ScreenLines([1,10], winwidth(0)+1)
147  let expect = [
148        \ "<aaa aaa a|",
149        \ "a aaa aaa |",
150        \ "aa aaa aaa|",
151        \ " aa aaa aa|",
152        \ "a aa aaa a|",
153        \ "aa aa aaa |",
154        \ "aaa aa aaa|",
155        \ " aaa aa aa|",
156        \ "a aaa aa a|",
157        \ "aa aaa aa |",
158        \ ]
159  call assert_equal(expect, lines)
160  set list& listchars& wrap&
161  bw!
162endfunc
163
164" Check that win_lines() works correctly with the number_only parameter=TRUE
165" should break early to optimize cost of drawing, but needs to make sure
166" that the number column is correctly highlighted.
167func Test_scroll_CursorLineNr_update()
168  CheckScreendump
169
170  let lines =<< trim END
171    hi CursorLineNr ctermfg=73 ctermbg=236
172    set nu rnu cursorline cursorlineopt=number
173    exe ":norm! o\<esc>110ia\<esc>"
174  END
175  let filename = 'Xdrawscreen'
176  call writefile(lines, filename, 'D')
177  let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50})
178  call term_sendkeys(buf, "k")
179  call VerifyScreenDump(buf, 'Test_winline_rnu', {})
180
181  " clean up
182  call StopVimInTerminal(buf)
183endfunc
184
185" check a long file name does not result in the hit-enter prompt
186func Test_edit_long_file_name()
187  CheckScreendump
188
189  let longName = 'x'->repeat(min([&columns, 255]))
190  call writefile([], longName, 'D')
191  let buf = RunVimInTerminal('-N -u NONE --cmd ":set noshowcmd noruler" ' .. longName, #{rows: 8})
192
193  call VerifyScreenDump(buf, 'Test_long_file_name_1', {})
194
195  call term_sendkeys(buf, ":set showcmd\<cr>:e!\<cr>")
196  call VerifyScreenDump(buf, 'Test_long_file_name_2', {})
197
198  " clean up
199  call StopVimInTerminal(buf)
200  set ruler&vim
201endfunc
202
203func Test_edit_long_file_name_with_ruler()
204  CheckScreendump
205
206  let longName = 'x'->repeat(min([&columns, 255]))
207  call writefile([], longName, 'D')
208  let buf = RunVimInTerminal('-N -u NONE --cmd ":set noshowcmd" ' .. longName, #{rows: 8})
209
210  call VerifyScreenDump(buf, 'Test_long_file_name_3', {})
211
212  call term_sendkeys(buf, ":set showcmd\<cr>:e!\<cr>")
213  call VerifyScreenDump(buf, 'Test_long_file_name_4', {})
214
215  " clean up
216  call StopVimInTerminal(buf)
217endfunc
218
219func Test_unprintable_fileformats()
220  CheckScreendump
221
222  call writefile(["unix\r", "two"], 'Xunix.txt', 'D')
223  call writefile(["mac\r", "two"], 'Xmac.txt', 'D')
224  let lines =<< trim END
225    edit Xunix.txt
226    split Xmac.txt
227    edit ++ff=mac
228  END
229  let filename = 'Xunprintable'
230  call writefile(lines, filename, 'D')
231  let buf = RunVimInTerminal('-S '.filename, #{rows: 9, cols: 50})
232  call VerifyScreenDump(buf, 'Test_display_unprintable_01', {})
233  call term_sendkeys(buf, "\<C-W>\<C-W>\<C-L>")
234  call VerifyScreenDump(buf, 'Test_display_unprintable_02', {})
235
236  " clean up
237  call StopVimInTerminal(buf)
238endfunc
239
240func Test_display_scroll_at_topline()
241  CheckScreendump
242
243  let buf = RunVimInTerminal('', #{cols: 20})
244  call term_sendkeys(buf, ":call setline(1, repeat('a', 21))\<CR>")
245  call TermWait(buf)
246  call term_sendkeys(buf, "O\<Esc>")
247  call VerifyScreenDump(buf, 'Test_display_scroll_at_topline', #{rows: 4})
248
249  call StopVimInTerminal(buf)
250endfunc
251
252func Test_display_scroll_update_visual()
253  CheckScreendump
254
255  let lines =<< trim END
256      set scrolloff=0
257      call setline(1, repeat(['foo'], 10))
258      call sign_define('foo', { 'text': '>' })
259      call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 })
260      call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 })
261      autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif
262  END
263  call writefile(lines, 'XupdateVisual.vim', 'D')
264
265  let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60})
266  call term_sendkeys(buf, "VG7kk")
267  call WaitForAssert({-> assert_match('VISUAL.*\d\+\s\+\d', term_getline(buf, 8))}, 1000)
268  call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {})
269
270  call StopVimInTerminal(buf)
271endfunc
272
273func Test_display_scroll_setline()
274  CheckScreendump
275
276  let lines =<< trim END
277    setlocal scrolloff=5 signcolumn=yes
278    call setline(1, range(1, 100))
279    call sign_define('foo', #{text: '>'})
280    call sign_place(1, 'bar', 'foo', bufnr(), #{lnum: 71})
281    call sign_place(2, 'bar', 'foo', bufnr(), #{lnum: 72})
282    call sign_place(3, 'bar', 'foo', bufnr(), #{lnum: 73})
283    call sign_place(4, 'bar', 'foo', bufnr(), #{lnum: 74})
284    call sign_place(5, 'bar', 'foo', bufnr(), #{lnum: 75})
285    normal! G
286    autocmd CursorMoved * if line('.') == 79
287                      \ |   call sign_unplace('bar', #{id: 4})
288                      \ |   call setline(80, repeat('foo', 15))
289                      \ | elseif line('.') == 78
290                      \ |   call setline(72, repeat('bar', 10))
291                      \ | elseif line('.') == 77
292                      \ |   call sign_unplace('bar', #{id: 2})
293                      \ | endif
294  END
295  call writefile(lines, 'XscrollSetline.vim', 'D')
296
297  let buf = RunVimInTerminal('-S XscrollSetline.vim', #{rows: 15, cols: 20})
298  call VerifyScreenDump(buf, 'Test_display_scroll_setline_1', {})
299  call term_sendkeys(buf, '19k')
300  call VerifyScreenDump(buf, 'Test_display_scroll_setline_2', {})
301  call term_sendkeys(buf, 'k')
302  call VerifyScreenDump(buf, 'Test_display_scroll_setline_3', {})
303  call term_sendkeys(buf, 'k')
304  call VerifyScreenDump(buf, 'Test_display_scroll_setline_4', {})
305  call term_sendkeys(buf, 'k')
306  call VerifyScreenDump(buf, 'Test_display_scroll_setline_5', {})
307  call term_sendkeys(buf, 'k')
308  call VerifyScreenDump(buf, 'Test_display_scroll_setline_6', {})
309
310  call StopVimInTerminal(buf)
311endfunc
312
313func Test_display_hit_enter_setline()
314  CheckScreendump
315
316  let lines =<< trim END
317    call setline(1, range(1, 100))
318  END
319  call writefile(lines, 'XhitEnterSetline.vim', 'D')
320
321  let buf = RunVimInTerminal('-S XhitEnterSetline.vim', #{rows: 8, cols: 40})
322  call VerifyScreenDump(buf, 'Test_display_hit_enter_setline_1', {})
323  call term_sendkeys(buf, ':echo "abc\ndef\nghi"')
324  call term_sendkeys(buf, "\<CR>")
325  call VerifyScreenDump(buf, 'Test_display_hit_enter_setline_2', {})
326  call term_sendkeys(buf, ":call setline(2, repeat('foo', 35))\<CR>")
327  call VerifyScreenDump(buf, 'Test_display_hit_enter_setline_3', {})
328
329  call StopVimInTerminal(buf)
330endfunc
331
332" Test for 'eob' (EndOfBuffer) item in 'fillchars'
333func Test_eob_fillchars()
334  " default value
335  " call assert_match('eob:\~', &fillchars)
336  " invalid values
337  call assert_fails(':set fillchars=eob:', 'E1511:')
338  call assert_fails(':set fillchars=eob:xy', 'E1511:')
339  call assert_fails(':set fillchars=eob:\255', 'E1511:')
340  call assert_fails(':set fillchars=eob:<ff>', 'E1511:')
341  call assert_fails(":set fillchars=eob:\x01", 'E1512:')
342  call assert_fails(':set fillchars=eob:\\x01', 'E1512:')
343  " default is ~
344  new
345  redraw
346  call assert_equal('~', Screenline(2))
347  set fillchars=eob:+
348  redraw
349  call assert_equal('+', Screenline(2))
350  let &fillchars = 'eob: '
351  redraw
352  call assert_equal(' ', nr2char(screenchar(2, 1)))
353  set fillchars&
354  close
355endfunc
356
357" Test for 'foldopen', 'foldclose' and 'foldsep' in 'fillchars'
358func Test_fold_fillchars()
359  new
360  set fdc=2 foldenable foldmethod=manual
361  call setline(1, ['one', 'two', 'three', 'four', 'five'])
362  2,4fold
363  " First check for the default setting for a closed fold
364  let lines = ScreenLines([1, 3], 8)
365  let expected = [
366        \ '  one   ',
367        \ '+ +--  3',
368        \ '  five  '
369        \ ]
370  call assert_equal(expected, lines)
371  normal 2Gzo
372  " check the characters for an open fold
373  let lines = ScreenLines([1, 5], 8)
374  let expected = [
375        \ '  one   ',
376        \ '- two   ',
377        \ '| three ',
378        \ '| four  ',
379        \ '  five  '
380        \ ]
381  call assert_equal(expected, lines)
382
383  " change the setting
384  set fillchars=vert:\|,fold:-,eob:~,foldopen:[,foldclose:],foldsep:-
385
386  " check the characters for an open fold
387  let lines = ScreenLines([1, 5], 8)
388  let expected = [
389        \ '  one   ',
390        \ '[ two   ',
391        \ '- three ',
392        \ '- four  ',
393        \ '  five  '
394        \ ]
395  call assert_equal(expected, lines)
396
397  " check the characters for a closed fold
398  normal 2Gzc
399  let lines = ScreenLines([1, 3], 8)
400  let expected = [
401        \ '  one   ',
402        \ '] +--  3',
403        \ '  five  '
404        \ ]
405  call assert_equal(expected, lines)
406
407  set fdc=1 foldmethod=indent foldlevel=10
408  call setline(1, ['one', '	two', '	two', '		three', '		three', 'four'])
409  let lines = ScreenLines([1, 6], 22)
410  let expected = [
411        \ ' one                  ',
412        \ '[        two          ',
413        \ '-        two          ',
414        \ '[                three',
415        \ '2                three',
416        \ ' four                 ',
417        \ ]
418  call assert_equal(expected, lines)
419
420  " check setting foldinner
421  let &fillchars = &fillchars .. ',foldinner: '
422  let lines = ScreenLines([1, 6], 22)
423  let expected = [
424        \ ' one                  ',
425        \ '[        two          ',
426        \ '-        two          ',
427        \ '[                three',
428        \ '                 three',
429        \ ' four                 ',
430        \ ]
431  call assert_equal(expected, lines)
432
433  " check Unicode chars
434  set fillchars=foldopen:▼,foldclose:▶,fold:⋯,foldsep:‖,foldinner:⋮
435  let lines = ScreenLines([1, 6], 22)
436  let expected = [
437        \ ' one                  ',
438        \ '▼        two          ',
439        \ '‖        two          ',
440        \ '▼                three',
441        \ '⋮                three',
442        \ ' four                 ',
443        \ ]
444  call assert_equal(expected, lines)
445
446  set fillchars-=foldinner:⋮
447  let lines = ScreenLines([1, 6], 22)
448  let expected = [
449        \ ' one                  ',
450        \ '▼        two          ',
451        \ '‖        two          ',
452        \ '▼                three',
453        \ '2                three',
454        \ ' four                 ',
455        \ ]
456  call assert_equal(expected, lines)
457
458  normal! 5ggzc
459  let lines = ScreenLines([1, 5], 24)
460  let expected = [
461        \ ' one                    ',
462        \ '▼        two            ',
463        \ '‖        two            ',
464        \ '▶+---  2 lines: three⋯⋯⋯',
465        \ ' four                   ',
466        \ ]
467  call assert_equal(expected, lines)
468
469  %bw!
470  set fillchars& fdc& foldmethod& foldenable&
471endfunc
472
473func Test_local_fillchars()
474  CheckScreendump
475
476  let lines =<< trim END
477      call setline(1, ['window 1']->repeat(3))
478      setlocal fillchars=stl:1,stlnc:a,vert:=,eob:x
479      vnew
480      call setline(1, ['window 2']->repeat(3))
481      setlocal fillchars=stl:2,stlnc:b,vert:+,eob:y
482      new
483      wincmd J
484      call setline(1, ['window 3']->repeat(3))
485      setlocal fillchars=stl:3,stlnc:c,vert:<,eob:z
486      vnew
487      call setline(1, ['window 4']->repeat(3))
488      setlocal fillchars=stl:4,stlnc:d,vert:>,eob:o
489  END
490  call writefile(lines, 'Xdisplayfillchars', 'D')
491  let buf = RunVimInTerminal('-S Xdisplayfillchars', #{rows: 12})
492  call VerifyScreenDump(buf, 'Test_display_fillchars_1', {})
493
494  call term_sendkeys(buf, ":wincmd k\r")
495  call VerifyScreenDump(buf, 'Test_display_fillchars_2', {})
496
497  call StopVimInTerminal(buf)
498endfunc
499
500func Test_fillchars_vert_default()
501  CheckScreendump
502
503  let lines =<< trim END
504      hi VertSplit ctermfg=12 ctermbg=0
505      set fillchars=trunc:<
506      call setline(1, ['window 1']->repeat(3))
507      vnew
508      call setline(1, ['window 2']->repeat(3))
509  END
510  call writefile(lines, 'Xdisplayfillcharsvert', 'D')
511  let buf = RunVimInTerminal('-S Xdisplayfillcharsvert', #{rows: 8})
512  call VerifyScreenDump(buf, 'Test_display_fillchars_vert', {})
513
514  call StopVimInTerminal(buf)
515endfunc
516
517func Test_display_linebreak_breakat()
518  new
519  vert resize 25
520  let _breakat = &breakat
521  setl signcolumn=yes linebreak breakat=) showbreak=++
522  call setline(1, repeat('x', winwidth(0) - 2) .. ')abc')
523  let lines = ScreenLines([1, 2], 25)
524  let expected = [
525          \ '  xxxxxxxxxxxxxxxxxxxxxxx',
526          \ '  ++)abc                 ',
527          \ ]
528  call assert_equal(expected, lines)
529  setl breakindent breakindentopt=shift:2
530  let lines = ScreenLines([1, 2], 25)
531  let expected = [
532          \ '  xxxxxxxxxxxxxxxxxxxxxxx',
533          \ '    ++)abc               ',
534          \ ]
535  call assert_equal(expected, lines)
536  %bw!
537  let &breakat=_breakat
538endfunc
539
540func Run_Test_display_lastline(euro)
541  CheckScreendump
542
543  let lines =<< trim END
544      call setline(1, ['aaa', 'b'->repeat(200)])
545      set display=truncate
546
547      vsplit
548      100wincmd <
549  END
550  if a:euro != ''
551    let lines[2] = 'set fillchars=vert:\|,lastline:€'
552  endif
553  call writefile(lines, 'XdispLastline', 'D')
554  let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10})
555  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}1', {})
556
557  call term_sendkeys(buf, ":set display=lastline\<CR>")
558  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}2', {})
559
560  call term_sendkeys(buf, ":100wincmd >\<CR>")
561  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}3', {})
562
563  call term_sendkeys(buf, ":set display=truncate\<CR>")
564  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}4', {})
565
566  call term_sendkeys(buf, ":close\<CR>")
567  call term_sendkeys(buf, ":3split\<CR>")
568  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}5', {})
569
570  call term_sendkeys(buf, ":close\<CR>")
571  call term_sendkeys(buf, ":2vsplit\<CR>")
572  call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}6', {})
573
574  call StopVimInTerminal(buf)
575endfunc
576
577func Test_display_lastline_dump()
578  CheckScreendump
579
580  call Run_Test_display_lastline('')
581  call Run_Test_display_lastline('euro_')
582endfunc
583
584func Test_display_lastline_fails()
585  call assert_fails(':set fillchars=lastline:', 'E1511:')
586  call assert_fails(':set fillchars=lastline:〇', 'E1512:')
587endfunc
588
589func Test_display_long_lastline()
590  CheckScreendump
591
592  let lines =<< trim END
593    set display=lastline smoothscroll scrolloff=0
594    call setline(1, [
595      \'aaaaa'->repeat(150),
596      \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7)
597    \])
598  END
599
600  call writefile(lines, 'XdispLongline', 'D')
601  let buf = RunVimInTerminal('-S XdispLongline', #{rows: 14, cols: 35})
602
603  call term_sendkeys(buf, "736|")
604  call VerifyScreenDump(buf, 'Test_display_long_line_1', {})
605
606  " The correct part of the last line is moved into view.
607  call term_sendkeys(buf, "D")
608  call VerifyScreenDump(buf, 'Test_display_long_line_2', {})
609
610  " "w_skipcol" does not change because the topline is still long enough
611  " to maintain the current skipcol.
612  call term_sendkeys(buf, "g04l11gkD")
613  call VerifyScreenDump(buf, 'Test_display_long_line_3', {})
614
615  " "w_skipcol" is reset to bring the entire topline into view because
616  " the line length is now smaller than the current skipcol + marker.
617  call term_sendkeys(buf, "x")
618  call VerifyScreenDump(buf, 'Test_display_long_line_4', {})
619
620  call StopVimInTerminal(buf)
621endfunc
622
623" Moving the cursor to a line that doesn't fit in the window should show
624" correctly.
625func Test_display_cursor_long_line()
626  CheckScreendump
627
628  let lines =<< trim END
629    call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c'])
630    norm $j
631  END
632
633  call writefile(lines, 'XdispCursorLongline', 'D')
634  let buf = RunVimInTerminal('-S XdispCursorLongline', #{rows: 8})
635
636  call VerifyScreenDump(buf, 'Test_display_cursor_long_line_1', {})
637
638  " FIXME: moving the cursor above the topline does not set w_skipcol
639  " correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1).
640  call term_sendkeys(buf, ":set number cpo+=n scrolloff=0\<CR>")
641  call term_sendkeys(buf, '$0')
642  call VerifyScreenDump(buf, 'Test_display_cursor_long_line_2', {})
643
644  " Going to the start of the line with "b" did not set w_skipcol correctly
645  " with 'smoothscroll'.
646   call term_sendkeys(buf, ":set smoothscroll\<CR>")
647   call term_sendkeys(buf, '$b')
648   call VerifyScreenDump(buf, 'Test_display_cursor_long_line_3', {})
649  " Same for "ge".
650   call term_sendkeys(buf, '$ge')
651   call VerifyScreenDump(buf, 'Test_display_cursor_long_line_4', {})
652
653  call StopVimInTerminal(buf)
654endfunc
655
656func Test_change_wrapped_line_cpo_dollar()
657  CheckScreendump
658
659  let lines =<< trim END
660    set cpoptions+=$ laststatus=0
661    call setline(1, ['foo', 'bar',
662          \ repeat('x', 25) .. '!!()!!' .. repeat('y', 25),
663          \ 'FOO', 'BAR'])
664    inoremap <F2> <Cmd>call setline(1, repeat('z', 30))<CR>
665    inoremap <F3> <Cmd>call setline(1, 'foo')<CR>
666    vsplit
667    call cursor(3, 1)
668  END
669  call writefile(lines, 'Xwrapped_cpo_dollar', 'D')
670  let buf = RunVimInTerminal('-S Xwrapped_cpo_dollar', #{rows: 10, cols: 45})
671
672  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_01', {})
673  call term_sendkeys(buf, 'ct!')
674  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_02', {})
675  call term_sendkeys(buf, "\<F2>")
676  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_03', {})
677  call term_sendkeys(buf, "\<F3>")
678  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_02', {})
679  call term_sendkeys(buf, 'y')
680  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_04', {})
681  call term_sendkeys(buf, 'y')
682  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_05', {})
683  call term_sendkeys(buf, "\<Esc>")
684  call TermWait(buf, 50)
685  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_06', {})
686
687  call term_sendkeys(buf, ":silent undo | echo\<CR>")
688  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_01', {})
689  call term_sendkeys(buf, ":source samples/matchparen.vim\<CR>")
690  call term_sendkeys(buf, 'ct(')
691  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_07', {})
692  call term_sendkeys(buf, 'y')
693  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_08', {})
694  call term_sendkeys(buf, 'y')
695  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_09', {})
696  call term_sendkeys(buf, "\<Esc>")
697  call TermWait(buf, 50)
698  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_10', {})
699
700  call term_sendkeys(buf, ":silent undo | echo\<CR>")
701  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_01', {})
702  call term_sendkeys(buf, "f(azz\<CR>zz\<Esc>k0")
703  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_11', {})
704  call term_sendkeys(buf, 'ct(')
705  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_12', {})
706  call term_sendkeys(buf, 'y')
707  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_13', {})
708  call term_sendkeys(buf, 'y')
709  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_14', {})
710  call term_sendkeys(buf, "\<Esc>")
711  call TermWait(buf, 50)
712  call VerifyScreenDump(buf, 'Test_change_wrapped_line_cpo_dollar_15', {})
713
714  call StopVimInTerminal(buf)
715endfunc
716
717" vim: shiftwidth=2 sts=2 expandtab