neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

test_display.vim (21886B)


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