neovim

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

scroll_opt_spec.lua (55397B)


      1 local n = require('test.functional.testnvim')()
      2 local Screen = require('test.functional.ui.screen')
      3 
      4 local clear = n.clear
      5 local exec = n.exec
      6 local feed = n.feed
      7 local assert_alive = n.assert_alive
      8 
      9 before_each(clear)
     10 
     11 describe('smoothscroll', function()
     12  local screen
     13 
     14  before_each(function()
     15    screen = Screen.new(40, 12)
     16  end)
     17 
     18  -- oldtest: Test_CtrlE_CtrlY_stop_at_end()
     19  it('disabled does not break <C-E> and <C-Y> stop at end', function()
     20    exec([[
     21      enew
     22      call setline(1, ['one', 'two'])
     23      set number
     24    ]])
     25    feed('<C-Y>')
     26    screen:expect({ any = '{8:  1 }^one' })
     27    feed('<C-E><C-E><C-E>')
     28    screen:expect({ any = '{8:  2 }^two' })
     29  end)
     30 
     31  -- oldtest: Test_smoothscroll_CtrlE_CtrlY()
     32  it('works with <C-E> and <C-E>', function()
     33    exec([[
     34      call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ])
     35      set smoothscroll scrolloff=5
     36      :5
     37    ]])
     38    local s1 = [[
     39      word word word word word word word word |*2
     40      word word word word                     |
     41      line three                              |
     42      long word long word long word long word |
     43      long word long word long word           |
     44      ^line                                    |
     45      line                                    |*2
     46      {1:~                                       }|*2
     47                                              |
     48    ]]
     49    local s2 = [[
     50      {1:<<<}d word word word word word word word |
     51      word word word word                     |
     52      line three                              |
     53      long word long word long word long word |
     54      long word long word long word           |
     55      ^line                                    |
     56      line                                    |*2
     57      {1:~                                       }|*3
     58                                              |
     59    ]]
     60    local s3 = [[
     61      {1:<<<}d word word word                     |
     62      line three                              |
     63      long word long word long word long word |
     64      long word long word long word           |
     65      ^line                                    |
     66      line                                    |*2
     67      {1:~                                       }|*4
     68                                              |
     69    ]]
     70    local s4 = [[
     71      line three                              |
     72      long word long word long word long word |
     73      long word long word long word           |
     74      line                                    |*2
     75      ^line                                    |
     76      {1:~                                       }|*5
     77                                              |
     78    ]]
     79    local s5 = [[
     80      {1:<<<}d word word word                     |
     81      line three                              |
     82      long word long word long word long word |
     83      long word long word long word           |
     84      line                                    |*2
     85      ^line                                    |
     86      {1:~                                       }|*4
     87                                              |
     88    ]]
     89    local s6 = [[
     90      {1:<<<}d word word word word word word word |
     91      word word word word                     |
     92      line three                              |
     93      long word long word long word long word |
     94      long word long word long word           |
     95      line                                    |*2
     96      ^line                                    |
     97      {1:~                                       }|*3
     98                                              |
     99    ]]
    100    local s7 = [[
    101      word word word word word word word word |*2
    102      word word word word                     |
    103      line three                              |
    104      long word long word long word long word |
    105      long word long word long word           |
    106      line                                    |*2
    107      ^line                                    |
    108      {1:~                                       }|*2
    109                                              |
    110    ]]
    111    local s8 = [[
    112      line one                                |
    113      word word word word word word word word |*2
    114      word word word word                     |
    115      line three                              |
    116      long word long word long word long word |
    117      long word long word long word           |
    118      line                                    |*2
    119      ^line                                    |
    120      {1:~                                       }|
    121                                              |
    122    ]]
    123    feed('<C-E>')
    124    screen:expect(s1)
    125    feed('<C-E>')
    126    screen:expect(s2)
    127    feed('<C-E>')
    128    screen:expect(s3)
    129    feed('<C-E>')
    130    screen:expect(s4)
    131    feed('<C-Y>')
    132    screen:expect(s5)
    133    feed('<C-Y>')
    134    screen:expect(s6)
    135    feed('<C-Y>')
    136    screen:expect(s7)
    137    feed('<C-Y>')
    138    screen:expect(s8)
    139    exec('set foldmethod=indent')
    140    -- move the cursor so we can reuse the same dumps
    141    feed('5G<C-E>')
    142    screen:expect(s1)
    143    feed('<C-E>')
    144    screen:expect(s2)
    145    feed('7G<C-Y>')
    146    screen:expect(s7)
    147    feed('<C-Y>')
    148    screen:expect(s8)
    149  end)
    150 
    151  -- oldtest: Test_smoothscroll_multibyte()
    152  it('works with multibyte characters', function()
    153    screen:try_resize(40, 6)
    154    exec([[
    155      set scrolloff=0 smoothscroll
    156      call setline(1, [repeat('ϛ', 45), repeat('2', 36)])
    157      exe "normal G35l\<C-E>k"
    158    ]])
    159    screen:expect([[
    160      ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
    161      ϛϛϛϛϛ                                   |
    162      222222222222222222222222222222222222    |
    163      {1:~                                       }|*2
    164                                              |
    165    ]])
    166  end)
    167 
    168  -- oldtest: Test_smoothscroll_number()
    169  it("works 'number' and 'cpo'+=n", function()
    170    exec([[
    171      call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ])
    172      set smoothscroll scrolloff=5
    173      set splitkeep=topline
    174      set number cpo+=n
    175      :3
    176      func g:DoRel()
    177        set number relativenumber scrolloff=0
    178        :%del
    179        call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ])
    180        exe "normal 2Gzt\<C-E>"
    181      endfunc
    182    ]])
    183    screen:expect([[
    184      {8:  1 }one word word word word word word wo|
    185      rd word word word word word word word wo|
    186      rd word word word word word             |
    187      {8:  2 }two long word long word long word lo|
    188      ng word long word long word long word   |
    189      {8:  3 }^line                                |
    190      {8:  4 }line                                |
    191      {8:  5 }line                                |
    192      {1:~                                       }|*3
    193                                              |
    194    ]])
    195    feed('<C-E>')
    196    screen:expect([[
    197      {1:<<<}word word word word word word word wo|
    198      rd word word word word word             |
    199      {8:  2 }two long word long word long word lo|
    200      ng word long word long word long word   |
    201      {8:  3 }^line                                |
    202      {8:  4 }line                                |
    203      {8:  5 }line                                |
    204      {1:~                                       }|*4
    205                                              |
    206    ]])
    207    feed('<C-E>')
    208    screen:expect([[
    209      {1:<<<}word word word word word             |
    210      {8:  2 }two long word long word long word lo|
    211      ng word long word long word long word   |
    212      {8:  3 }^line                                |
    213      {8:  4 }line                                |
    214      {8:  5 }line                                |
    215      {1:~                                       }|*5
    216                                              |
    217    ]])
    218    exec('set cpo-=n')
    219    screen:expect([[
    220      {1:<<<}{8: }d word word word word word word     |
    221      {8:  2 }two long word long word long word lo|
    222      {8:    }ng word long word long word long wor|
    223      {8:    }d                                   |
    224      {8:  3 }^line                                |
    225      {8:  4 }line                                |
    226      {8:  5 }line                                |
    227      {1:~                                       }|*4
    228                                              |
    229    ]])
    230    feed('<C-Y>')
    231    screen:expect([[
    232      {1:<<<}{8: }rd word word word word word word wor|
    233      {8:    }d word word word word word word     |
    234      {8:  2 }two long word long word long word lo|
    235      {8:    }ng word long word long word long wor|
    236      {8:    }d                                   |
    237      {8:  3 }^line                                |
    238      {8:  4 }line                                |
    239      {8:  5 }line                                |
    240      {1:~                                       }|*3
    241                                              |
    242    ]])
    243    feed('<C-Y>')
    244    screen:expect([[
    245      {8:  1 }one word word word word word word wo|
    246      {8:    }rd word word word word word word wor|
    247      {8:    }d word word word word word word     |
    248      {8:  2 }two long word long word long word lo|
    249      {8:    }ng word long word long word long wor|
    250      {8:    }d                                   |
    251      {8:  3 }^line                                |
    252      {8:  4 }line                                |
    253      {8:  5 }line                                |
    254      {1:~                                       }|*2
    255                                              |
    256    ]])
    257    exec('botright split')
    258    feed('gg')
    259    screen:expect([[
    260      {8:  1 }one word word word word word word wo|
    261      {8:    }rd word word word word word word wor|
    262      {8:    }d word word word word word word     |
    263      {8:  2 }two long word long word long word{1:@@@}|
    264      {2:[No Name] [+]                           }|
    265      {8:  1 }^one word word word word word word wo|
    266      {8:    }rd word word word word word word wor|
    267      {8:    }d word word word word word word     |
    268      {8:  2 }two long word long word long word lo|
    269      {8:    }ng word long word long word long {1:@@@}|
    270      {3:[No Name] [+]                           }|
    271                                              |
    272    ]])
    273 
    274    feed('<C-E>')
    275    screen:expect([[
    276      {8:  1 }one word word word word word word wo|
    277      {8:    }rd word word word word word word wor|
    278      {8:    }d word word word word word word     |
    279      {8:  2 }two long word long word long word{1:@@@}|
    280      {2:[No Name] [+]                           }|
    281      {1:<<<}{8: }rd word word word word word word wor|
    282      {8:    }d word word word word word word^     |
    283      {8:  2 }two long word long word long word lo|
    284      {8:    }ng word long word long word long wor|
    285      {8:    }d                                   |
    286      {3:[No Name] [+]                           }|
    287                                              |
    288    ]])
    289 
    290    feed('<C-E>')
    291    screen:expect([[
    292      {8:  1 }one word word word word word word wo|
    293      {8:    }rd word word word word word word wor|
    294      {8:    }d word word word word word word     |
    295      {8:  2 }two long word long word long word{1:@@@}|
    296      {2:[No Name] [+]                           }|
    297      {1:<<<}{8: }d word word word word word word^     |
    298      {8:  2 }two long word long word long word lo|
    299      {8:    }ng word long word long word long wor|
    300      {8:    }d                                   |
    301      {8:  3 }line                                |
    302      {3:[No Name] [+]                           }|
    303                                              |
    304    ]])
    305    exec('close')
    306    exec('call DoRel()')
    307    screen:expect([[
    308      {8:2}{1:<<<}^ong text very long text very long te|
    309      {8:    }xt very long text very long text ver|
    310      {8:    }y long text very long text very long|
    311      {8:    } text very long text very long text |
    312      {8:  1 }three                               |
    313      {1:~                                       }|*6
    314      --No lines in buffer--                  |
    315    ]])
    316  end)
    317 
    318  -- oldtest: Test_smoothscroll_list()
    319  it('works with list mode', function()
    320    screen:try_resize(40, 8)
    321    exec([[
    322      set smoothscroll scrolloff=0
    323      set list
    324      call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ])
    325      exe "normal 2Gzt\<C-E>"
    326    ]])
    327    screen:expect([[
    328      {1:<<<}t very long text very long text very |
    329      ^long text very long text very long text |
    330      very long text very long text very long |
    331      text very long text{1:-}                    |
    332      three                                   |
    333      {1:~                                       }|*2
    334                                              |
    335    ]])
    336    exec('set listchars+=precedes:#')
    337    screen:expect([[
    338      {1:#}ext very long text very long text very |
    339      ^long text very long text very long text |
    340      very long text very long text very long |
    341      text very long text{1:-}                    |
    342      three                                   |
    343      {1:~                                       }|*2
    344                                              |
    345    ]])
    346  end)
    347 
    348  -- oldtest: Test_smoothscroll_diff_mode()
    349  it('works with diff mode', function()
    350    screen:try_resize(40, 8)
    351    exec([[
    352      let text = 'just some text here'
    353      call setline(1, text)
    354      set smoothscroll
    355      diffthis
    356      new
    357      call setline(1, text)
    358      set smoothscroll
    359      diffthis
    360    ]])
    361 
    362    screen:expect([[
    363      {7:- }^just some text here                   |
    364      {1:~                                       }|*2
    365      {3:[No Name] [+]                           }|
    366      {7:- }just some text here                   |
    367      {1:~                                       }|
    368      {2:[No Name] [+]                           }|
    369                                              |
    370    ]])
    371    feed('<C-Y>')
    372    screen:expect_unchanged()
    373    feed('<C-E>')
    374    screen:expect_unchanged()
    375  end)
    376 
    377  -- oldtest: Test_smoothscroll_diff_change_line()
    378  it('works in diff mode when changing line', function()
    379    screen:try_resize(55, 20)
    380    exec([[
    381      set diffopt+=followwrap smoothscroll
    382      call setline(1, repeat(' abc', &columns))
    383      call setline(2, 'bar')
    384      call setline(3, repeat(' abc', &columns))
    385      vnew
    386      call setline(1, repeat(' abc', &columns))
    387      call setline(2, 'foo')
    388      call setline(3, 'bar')
    389      call setline(4, repeat(' abc', &columns))
    390      windo exe "normal! 2gg5\<C-E>"
    391      windo diffthis
    392    ]])
    393 
    394    screen:expect([[
    395      {1:<<<}bc abc abc abc abc abc a{1:<<<}bc abc abc abc abc abc a|
    396      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    397      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    398      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    399      {7:  }{22:foo                      }{7:  }{23:-------------------------}|
    400      {7:  }bar                      {7:  }^bar                      |
    401      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    402      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    403      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    404      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    405      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    406      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    407      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    408      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    409      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    410      {1:~                          }{1:~                          }|*3
    411      {2:[No Name] [+]               }{3:[No Name] [+]              }|
    412                                                             |
    413    ]])
    414    feed('Abar')
    415    screen:expect([[
    416      {1:<<<}bc abc abc abc abc abc a{1:<<<}bc abc abc abc abc abc a|
    417      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    418      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    419      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    420      {7:  }{22:foo                      }{7:  }{23:-------------------------}|
    421      {7:  }bar                      {7:  }barbar^                   |
    422      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    423      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    424      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    425      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    426      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    427      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    428      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    429      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    430      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    431      {1:~                          }{1:~                          }|*3
    432      {2:[No Name] [+]               }{3:[No Name] [+]              }|
    433      {5:-- INSERT --}                                           |
    434    ]])
    435    feed('<Esc>')
    436    screen:expect([[
    437      {1:<<<}bc abc abc abc abc abc a{1:<<<}bc abc abc abc abc abc a|
    438      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    439      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    440      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    441      {7:  }{22:foo                      }{7:  }{23:-------------------------}|
    442      {7:  }{4:bar                      }{7:  }{4:bar}{27:ba^r}{4:                   }|
    443      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    444      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    445      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    446      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    447      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    448      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    449      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    450      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    451      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    452      {1:~                          }{1:~                          }|*3
    453      {2:[No Name] [+]               }{3:[No Name] [+]              }|
    454                                                             |
    455    ]])
    456    feed('yyp')
    457    screen:expect([[
    458      {1:<<<}bc abc abc abc abc abc a{1:<<<}bc abc abc abc abc abc a|
    459      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    460      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    461      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    462      {7:  }{27:foo}{4:                      }{7:  }{27:barbar}{4:                   }|
    463      {7:  }{4:bar                      }{7:  }{4:^bar}{27:bar}{4:                   }|
    464      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    465      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    466      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    467      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    468      {7:  } abc abc abc abc abc abc {7:  } abc abc abc abc abc abc |
    469      {7:  }abc abc abc abc abc abc a{7:  }abc abc abc abc abc abc a|
    470      {7:  }bc abc abc abc abc abc ab{7:  }bc abc abc abc abc abc ab|
    471      {7:  }c abc abc abc abc abc abc{7:  }c abc abc abc abc abc abc|
    472      {7:  } abc abc abc abc abc     {7:  } abc abc abc abc abc     |
    473      {1:~                          }{1:~                          }|*3
    474      {2:[No Name] [+]               }{3:[No Name] [+]              }|
    475                                                             |
    476    ]])
    477  end)
    478 
    479  -- oldtest: Test_smoothscroll_wrap_scrolloff_zero()
    480  it("works with zero 'scrolloff'", function()
    481    screen:try_resize(40, 8)
    482    exec([[
    483      call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
    484      set smoothscroll scrolloff=0 display=
    485      :3
    486    ]])
    487    screen:expect([[
    488      {1:<<<}h some text with some text           |
    489      Line with some text with some text with |
    490      some text with some text with some text |
    491      with some text with some text           |
    492      ^Line with some text with some text with |
    493      some text with some text with some text |
    494      with some text with some text           |
    495                                              |
    496    ]])
    497    feed('j')
    498    screen:expect_unchanged()
    499    -- moving cursor down - whole bottom line shows
    500    feed('<C-E>j')
    501    screen:expect_unchanged()
    502    feed('G')
    503    screen:expect_unchanged()
    504    feed('4<C-Y>G')
    505    screen:expect_unchanged()
    506    -- moving cursor up right after the <<< marker - no need to show whole line
    507    feed('2gj3l2k')
    508    screen:expect([[
    509      {1:<<<}^h some text with some text           |
    510      Line with some text with some text with |
    511      some text with some text with some text |
    512      with some text with some text           |
    513      Line with some text with some text with |
    514      some text with some text with some text |
    515      with some text with some text           |
    516                                              |
    517    ]])
    518    -- moving cursor up where the <<< marker is - whole top line shows
    519    feed('2j02k')
    520    screen:expect([[
    521      ^Line with some text with some text with |
    522      some text with some text with some text |
    523      with some text with some text           |
    524      Line with some text with some text with |
    525      some text with some text with some text |
    526      with some text with some text           |
    527      {1:@                                       }|
    528                                              |
    529    ]])
    530  end)
    531 
    532  -- oldtest: Test_smoothscroll_wrap_long_line()
    533  it('adjusts the cursor position in a long line', function()
    534    screen:try_resize(40, 6)
    535    exec([[
    536      call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
    537      set smoothscroll scrolloff=0
    538      normal 3G10|zt
    539    ]])
    540    -- scrolling up, cursor moves screen line down
    541    screen:expect([[
    542      Line with^ lots of text with lots of text|
    543       with lots of text with lots of text wit|
    544      h lots of text with lots of text with lo|
    545      ts of text with lots of text with lots o|
    546      f text with lots of text with lots of te|
    547                                              |
    548    ]])
    549    feed('<C-E>')
    550    screen:expect([[
    551      {1:<<<}th lot^s of text with lots of text wit|
    552      h lots of text with lots of text with lo|
    553      ts of text with lots of text with lots o|
    554      f text with lots of text with lots of te|
    555      xt with lots of text with lots of text w|
    556                                              |
    557    ]])
    558    feed('5<C-E>')
    559    screen:expect([[
    560      {1:<<<} lots ^of text with lots of text with |
    561      lots of text with lots of text with lots|
    562       of text with lots of text with lots of |
    563      text with lots of text with lots of text|
    564       with lots of text with lots of text wit|
    565                                              |
    566    ]])
    567    -- scrolling down, cursor moves screen line up
    568    feed('5<C-Y>')
    569    screen:expect([[
    570      {1:<<<}th lots of text with lots of text wit|
    571      h lots of text with lots of text with lo|
    572      ts of text with lots of text with lots o|
    573      f text with lots of text with lots of te|
    574      xt with l^ots of text with lots of text w|
    575                                              |
    576    ]])
    577    feed('<C-Y>')
    578    screen:expect([[
    579      Line with lots of text with lots of text|
    580       with lots of text with lots of text wit|
    581      h lots of text with lots of text with lo|
    582      ts of text with lots of text with lots o|
    583      f text wi^th lots of text with lots of te|
    584                                              |
    585    ]])
    586    -- 'scrolloff' set to 1, scrolling up, cursor moves screen line down
    587    exec('set scrolloff=1')
    588    feed('10|<C-E>')
    589    screen:expect([[
    590      {1:<<<}th lots of text with lots of text wit|
    591      h lots of^ text with lots of text with lo|
    592      ts of text with lots of text with lots o|
    593      f text with lots of text with lots of te|
    594      xt with lots of text with lots of text w|
    595                                              |
    596    ]])
    597    -- 'scrolloff' set to 1, scrolling down, cursor moves screen line up
    598    feed('<C-E>gjgj<C-Y>')
    599    screen:expect([[
    600      {1:<<<}th lots of text with lots of text wit|
    601      h lots of text with lots of text with lo|
    602      ts of text with lots of text with lots o|
    603      f text wi^th lots of text with lots of te|
    604      xt with lots of text with lots of text w|
    605                                              |
    606    ]])
    607    -- 'scrolloff' set to 2, scrolling up, cursor moves screen line down
    608    exec('set scrolloff=2')
    609    feed('10|<C-E>')
    610    screen:expect([[
    611      {1:<<<}th lots of text with lots of text wit|
    612      h lots of text with lots of text with lo|
    613      ts of tex^t with lots of text with lots o|
    614      f text with lots of text with lots of te|
    615      xt with lots of text with lots of text w|
    616                                              |
    617    ]])
    618    -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up
    619    feed('<C-E>gj<C-Y>')
    620    screen:expect_unchanged()
    621    -- 'scrolloff' set to 0, move cursor down one line. Cursor should move properly,
    622    -- and since this is a really long line, it will be put on top of the screen.
    623    exec('set scrolloff=0')
    624    feed('0j')
    625    screen:expect([[
    626      {1:<<<}th lots of text with lots of text wit|
    627      h lots of text with lots of text with lo|
    628      ts of text with lots of text with lots o|
    629      f text with lots of text end            |
    630      ^four                                    |
    631                                              |
    632    ]])
    633    -- Test zt/zz/zb that they work properly when a long line is above it
    634    feed('zt')
    635    screen:expect([[
    636      ^four                                    |
    637      {1:~                                       }|*4
    638                                              |
    639    ]])
    640    feed('zz')
    641    screen:expect([[
    642      {1:<<<}of text with lots of text with lots o|
    643      f text with lots of text end            |
    644      ^four                                    |
    645      {1:~                                       }|*2
    646                                              |
    647    ]])
    648    feed('zb')
    649    screen:expect([[
    650      {1:<<<}th lots of text with lots of text wit|
    651      h lots of text with lots of text with lo|
    652      ts of text with lots of text with lots o|
    653      f text with lots of text end            |
    654      ^four                                    |
    655                                              |
    656    ]])
    657    -- Repeat the step and move the cursor down again.
    658    -- This time, use a shorter long line that is barely long enough to span more
    659    -- than one window. Note that the cursor is at the bottom this time because
    660    -- Vim prefers to do so if we are scrolling a few lines only.
    661    exec(
    662      "call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])"
    663    )
    664    -- Currently visible lines were replaced, test that the lines and cursor
    665    -- are correctly displayed.
    666    screen:expect_unchanged()
    667    feed('3Gztj')
    668    screen:expect_unchanged()
    669    -- Repeat the step but this time start it when the line is smooth-scrolled by
    670    -- one line. This tests that the offset calculation is still correct and
    671    -- still end up scrolling down to the next line with cursor at bottom of
    672    -- screen.
    673    feed('3Gzt<C-E>j')
    674    screen:expect([[
    675      {1:<<<}th lots of text with lots of text wit|
    676      h lots of text with lots of text with lo|
    677      ts of text with lots of text with lots o|
    678      f text with lots of text end            |
    679      fou^r                                    |
    680                                              |
    681    ]])
    682  end)
    683 
    684  -- oldtest: Test_smoothscroll_one_long_line()
    685  it('scrolls correctly when moving the cursor', function()
    686    screen:try_resize(40, 6)
    687    exec([[
    688      call setline(1, 'with lots of text '->repeat(7))
    689      set smoothscroll scrolloff=0
    690    ]])
    691    local s1 = [[
    692      ^with lots of text with lots of text with|
    693       lots of text with lots of text with lot|
    694      s of text with lots of text with lots of|
    695       text                                   |
    696      {1:~                                       }|
    697                                              |
    698    ]]
    699    screen:expect(s1)
    700    feed('<C-E>')
    701    screen:expect([[
    702      {1:<<<}ts of text with lots of text with lot|
    703      ^s of text with lots of text with lots of|
    704       text                                   |
    705      {1:~                                       }|*2
    706                                              |
    707    ]])
    708    feed('0')
    709    screen:expect(s1)
    710  end)
    711 
    712  -- oldtest: Test_smoothscroll_long_line_showbreak()
    713  it('cursor is not one screen line too far down', function()
    714    screen:try_resize(40, 6)
    715    -- a line that spans four screen lines
    716    exec("call setline(1, 'with lots of text in one line '->repeat(6))")
    717    exec('set smoothscroll scrolloff=0 showbreak=+++\\ ')
    718    local s1 = [[
    719      ^with lots of text in one line with lots |
    720      {1:+++ }of text in one line with lots of tex|
    721      {1:+++ }t in one line with lots of text in o|
    722      {1:+++ }ne line with lots of text in one lin|
    723      {1:+++ }e with lots of text in one line     |
    724                                              |
    725    ]]
    726    screen:expect(s1)
    727    feed('<C-E>')
    728    screen:expect([[
    729      {1:+++ }^of text in one line with lots of tex|
    730      {1:+++ }t in one line with lots of text in o|
    731      {1:+++ }ne line with lots of text in one lin|
    732      {1:+++ }e with lots of text in one line     |
    733      {1:~                                       }|
    734                                              |
    735    ]])
    736    feed('0')
    737    screen:expect(s1)
    738  end)
    739 
    740  -- oldtest: Test_smoothscroll_marker_over_double_width_dump()
    741  it('marker is drawn over double-width char correctly', function()
    742    screen:try_resize(40, 6)
    743    exec([[
    744      call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10))
    745      setlocal smoothscroll
    746    ]])
    747    screen:expect([[
    748      ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
    749      口口口口口口口口口口                    |
    750      {1:~                                       }|*3
    751                                              |
    752    ]])
    753    feed('<C-E>')
    754    screen:expect([[
    755      {1:<<<} 口口口口口口口^                    |
    756      {1:~                                       }|*4
    757                                              |
    758    ]])
    759  end)
    760 
    761  -- oldtest: Test_smoothscroll_zero_width()
    762  it('does not divide by zero with a narrow window', function()
    763    screen:try_resize(12, 2)
    764    exec([[
    765      call setline(1, ['a'->repeat(100)])
    766      set wrap smoothscroll number laststatus=0
    767      wincmd v
    768      wincmd v
    769      wincmd v
    770      wincmd v
    771    ]])
    772    screen:expect([[
    773      {8:  1^ }{8: }{8: }{8: }{8: }|
    774                  |
    775    ]])
    776    feed('llllllllll<C-W>o')
    777    screen:expect([[
    778      {1:<<<}{8: }aa^aaaaaa|
    779                  |
    780    ]])
    781  end)
    782 
    783  -- oldtest: Test_smoothscroll_ins_lines()
    784  it('does not unnecessarily insert lines', function()
    785    screen:try_resize(40, 6)
    786    exec([=[
    787      set wrap smoothscroll scrolloff=0 conceallevel=2 concealcursor=nc
    788      call setline(1, [
    789        \'line one' .. 'with lots of text in one line '->repeat(2),
    790        \'line two',
    791        \'line three',
    792        \'line four',
    793        \'line five'
    794      \])
    795    ]=])
    796    feed('<C-E>gjgk')
    797    screen:expect([[
    798      {1:<<<}lots of text in one line^             |
    799      line two                                |
    800      line three                              |
    801      line four                               |
    802      line five                               |
    803                                              |
    804    ]])
    805  end)
    806 
    807  -- oldtest: Test_smoothscroll_cursormoved_line()
    808  it('does not place the cursor in the command line', function()
    809    screen:try_resize(40, 6)
    810    exec([=[
    811      set smoothscroll
    812      call setline(1, [
    813        \'',
    814        \'_'->repeat(&lines * &columns),
    815        \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2)
    816      \])
    817      autocmd CursorMoved * eval [line('w0'), line('w$')]
    818      call search('xxx')
    819    ]=])
    820    screen:expect([[
    821      {1:<<<}_____________________________________|
    822      ________________________________________|
    823      ______________________________________^xx|
    824      x______________________________________x|
    825      xx                                      |
    826                                              |
    827    ]])
    828  end)
    829 
    830  -- oldtest: Test_smoothscroll_eob()
    831  it('does not scroll halfway at end of buffer', function()
    832    screen:try_resize(40, 10)
    833    exec([[
    834      set smoothscroll
    835      call setline(1, ['']->repeat(100))
    836      norm G
    837    ]])
    838    -- does not scroll halfway when scrolling to end of buffer
    839    screen:expect([[
    840                                              |*8
    841      ^                                        |
    842                                              |
    843    ]])
    844    exec("call setline(92, 'a'->repeat(100))")
    845    feed('<C-L><C-B>G')
    846    -- cursor is not placed below window
    847    screen:expect([[
    848      {1:<<<}aaaaaaaaaaaaaaaaa                    |
    849                                              |*7
    850      ^                                        |
    851                                              |
    852    ]])
    853  end)
    854 
    855  -- oldtest: Test_smoothscroll_incsearch()
    856  it('does not reset skipcol when doing incremental search on the same word', function()
    857    screen:try_resize(40, 8)
    858    exec([[
    859      set smoothscroll number scrolloff=0 incsearch
    860      call setline(1, repeat([''], 20))
    861      call setline(11, repeat('a', 100))
    862      call setline(14, 'bbbb')
    863    ]])
    864    feed('/b')
    865    screen:expect([[
    866      {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa        |
    867      {8: 12 }                                    |
    868      {8: 13 }                                    |
    869      {8: 14 }{2:b}{10:bbb}                                |
    870      {8: 15 }                                    |
    871      {8: 16 }                                    |
    872      {8: 17 }                                    |
    873      /b^                                      |
    874    ]])
    875    feed('b')
    876    screen:expect([[
    877      {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa        |
    878      {8: 12 }                                    |
    879      {8: 13 }                                    |
    880      {8: 14 }{2:bb}{10:bb}                                |
    881      {8: 15 }                                    |
    882      {8: 16 }                                    |
    883      {8: 17 }                                    |
    884      /bb^                                     |
    885    ]])
    886    feed('b')
    887    screen:expect([[
    888      {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa        |
    889      {8: 12 }                                    |
    890      {8: 13 }                                    |
    891      {8: 14 }{2:bbb}b                                |
    892      {8: 15 }                                    |
    893      {8: 16 }                                    |
    894      {8: 17 }                                    |
    895      /bbb^                                    |
    896    ]])
    897    feed('b')
    898    screen:expect([[
    899      {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa        |
    900      {8: 12 }                                    |
    901      {8: 13 }                                    |
    902      {8: 14 }{2:bbbb}                                |
    903      {8: 15 }                                    |
    904      {8: 16 }                                    |
    905      {8: 17 }                                    |
    906      /bbbb^                                   |
    907    ]])
    908  end)
    909 
    910  -- oldtest: Test_smoothscroll_multi_skipcol()
    911  it('scrolling multiple lines and stopping at non-zero skipcol', function()
    912    screen:try_resize(40, 10)
    913    exec([[
    914      setlocal cursorline scrolloff=0 smoothscroll
    915      call setline(1, repeat([''], 8))
    916      call setline(3, repeat('a', 50))
    917      call setline(4, repeat('a', 50))
    918      call setline(7, 'bbb')
    919      call setline(8, 'ccc')
    920      redraw
    921    ]])
    922    screen:expect([[
    923      {21:^                                        }|
    924                                              |
    925      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
    926      aaaaaaaaaa                              |
    927      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
    928      aaaaaaaaaa                              |
    929                                              |*2
    930      bbb                                     |
    931                                              |
    932    ]])
    933    feed('3<C-E>')
    934    screen:expect([[
    935      {1:<<<}{21:aaaaaa^a                              }|
    936      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
    937      aaaaaaaaaa                              |
    938                                              |*2
    939      bbb                                     |
    940      ccc                                     |
    941      {1:~                                       }|*2
    942                                              |
    943    ]])
    944    feed('2<C-E>')
    945    screen:expect([[
    946      {1:<<<}{21:aaaaaa^a                              }|
    947                                              |*2
    948      bbb                                     |
    949      ccc                                     |
    950      {1:~                                       }|*4
    951                                              |
    952    ]])
    953  end)
    954 
    955  -- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot()
    956  it('does not divide by zero in zero-width window', function()
    957    screen:try_resize(40, 19)
    958    exec([[
    959      silent normal yy
    960      silent normal 19p
    961      set cpoptions+=n
    962      vsplit
    963      vertical resize 0
    964      set foldcolumn=1
    965      set number
    966      set smoothscroll
    967      silent normal 20G
    968    ]])
    969    screen:expect([[
    970      {8: }                                      |
    971      {1:@}                                      |*15
    972      {1:^@}                                      |
    973      {3:< }{2:[No Name] [+]                         }|
    974                                              |
    975    ]])
    976  end)
    977 
    978  -- oldtest: Test_smoothscroll_cursor_top()
    979  it('resets skipcol when scrolling cursor to top', function()
    980    screen:try_resize(40, 12)
    981    exec([[
    982      set smoothscroll scrolloff=2
    983      new | 11resize | wincmd j
    984      call setline(1, ['line1', 'line2', 'line3'->repeat(20), 'line4'])
    985      exe "norm G3\<C-E>k"
    986    ]])
    987    screen:expect([[
    988                                              |
    989      {2:[No Name]                               }|
    990      line1                                   |
    991      line2                                   |
    992      ^line3line3line3line3line3line3line3line3|
    993      line3line3line3line3line3line3line3line3|
    994      line3line3line3line3                    |
    995      line4                                   |
    996      {1:~                                       }|*2
    997      {3:[No Name] [+]                           }|
    998                                              |
    999    ]])
   1000  end)
   1001 
   1002  -- oldtest: Test_smoothscroll_crash()
   1003  it('does not crash with small window and cpo+=n', function()
   1004    screen:try_resize(40, 12)
   1005    exec([[
   1006      20 new
   1007      vsp
   1008      put =repeat('aaaa', 20)
   1009      set nu fdc=1  smoothscroll cpo+=n
   1010      vert resize 0
   1011      exe "norm! 0\<c-e>"
   1012    ]])
   1013    feed('2<C-E>')
   1014    assert_alive()
   1015  end)
   1016 
   1017  -- oldtest: Test_smoothscroll_insert_bottom()
   1018  it('works in Insert mode at bottom of window', function()
   1019    screen:try_resize(40, 9)
   1020    exec([[
   1021      call setline(1, repeat([repeat('A very long line ...', 10)], 5))
   1022      set wrap smoothscroll scrolloff=0
   1023    ]])
   1024    feed('Go123456789<CR>')
   1025    screen:expect([[
   1026      {1:<<<}ery long line ...A very long line ...|
   1027      A very long line ...A very long line ...|*5
   1028      123456789                               |
   1029      ^                                        |
   1030      {5:-- INSERT --}                            |
   1031    ]])
   1032  end)
   1033 
   1034  -- oldtest: Test_smoothscroll_in_qf_window()
   1035  it('works in quickfix window when changing quickfix list', function()
   1036    screen:try_resize(60, 20)
   1037    exec([[
   1038      set nocompatible display=lastline
   1039      copen 5
   1040      setlocal number smoothscroll
   1041      let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10)
   1042      call setqflist(g:l, 'r')
   1043      normal! G
   1044      wincmd t
   1045      let g:l1 = [{'text': join(range(1000))}]
   1046    ]])
   1047    screen:expect([[
   1048      ^                                                            |
   1049      {1:~                                                           }|*11
   1050      {3:[No Name]                                                   }|
   1051      {1:<<<}{8: }21 22 23 24 25 26 27 28 29                              |
   1052      {8: 10 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
   1053      {8:    }21 22 23 24 25 26 27 28 29                              |
   1054      {8: 11 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
   1055      {8:    }21 22 23 24 25 26 27 28 29                              |
   1056      {2:[Quickfix List] [-]                                         }|
   1057                                                                  |
   1058    ]])
   1059 
   1060    feed([[:call setqflist([], 'r')<CR>]])
   1061    local screen_empty = [[
   1062      ^                                                            |
   1063      {1:~                                                           }|*11
   1064      {3:[No Name]                                                   }|
   1065      {8:  1 }                                                        |
   1066      {1:~                                                           }|*4
   1067      {2:[Quickfix List] [-]                                         }|
   1068      :call setqflist([], 'r')                                    |
   1069    ]]
   1070    screen:expect(screen_empty)
   1071 
   1072    feed([[:call setqflist(g:l, 'r')<CR>]])
   1073    local screen_l_top = [[
   1074      ^                                                            |
   1075      {1:~                                                           }|*11
   1076      {3:[No Name]                                                   }|
   1077      {8:  1 }{10:|| foo                                                  }|
   1078      {8:  2 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
   1079      {8:    }21 22 23 24 25 26 27 28 29                              |
   1080      {8:  3 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
   1081      {8:    }21 22 23 24 25 26 27 28 29                              |
   1082      {2:[Quickfix List] [-]                                         }|
   1083      :call setqflist(g:l, 'r')                                   |
   1084    ]]
   1085    screen:expect(screen_l_top)
   1086 
   1087    feed([[:call setqflist(g:l1, 'r')<CR>]])
   1088    local screen_l1_top = [[
   1089      ^                                                            |
   1090      {1:~                                                           }|*11
   1091      {3:[No Name]                                                   }|
   1092      {8:  1 }{10:|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 }|
   1093      {8:    }{10:21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39}|
   1094      {8:    }{10: 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 5}|
   1095      {8:    }{10:8 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 }|
   1096      {8:    }{10:77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95}|
   1097      {2:[Quickfix List] [-]                                         }|
   1098      :call setqflist(g:l1, 'r')                                  |
   1099    ]]
   1100    screen:expect(screen_l1_top)
   1101 
   1102    feed('<C-W>b$<C-W>t')
   1103    local screen_l1_bot = [[
   1104      ^                                                            |
   1105      {1:~                                                           }|*11
   1106      {3:[No Name]                                                   }|
   1107      {1:<<<}{8: }{10: 937 938 939 940 941 942 943 944 945 946 947 948 949 950}|
   1108      {8:    }{10: 951 952 953 954 955 956 957 958 959 960 961 962 963 964}|
   1109      {8:    }{10: 965 966 967 968 969 970 971 972 973 974 975 976 977 978}|
   1110      {8:    }{10: 979 980 981 982 983 984 985 986 987 988 989 990 991 992}|
   1111      {8:    }{10: 993 994 995 996 997 998 999                            }|
   1112      {2:[Quickfix List] [-]                                         }|
   1113      :call setqflist(g:l1, 'r')                                  |
   1114    ]]
   1115    screen:expect(screen_l1_bot)
   1116 
   1117    feed([[:call setqflist([], 'r')<CR>]])
   1118    screen:expect(screen_empty)
   1119 
   1120    feed([[:call setqflist(g:l1, 'r')<CR>]])
   1121    screen:expect(screen_l1_top)
   1122 
   1123    feed('<C-W>b$<C-W>t')
   1124    screen:expect(screen_l1_bot)
   1125 
   1126    feed([[:call setqflist(g:l, 'r')<CR>]])
   1127    screen:expect(screen_l_top)
   1128  end)
   1129 
   1130  it('works with virt_lines above and below', function()
   1131    screen:try_resize(55, 7)
   1132    exec([=[
   1133      call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(3))
   1134      set smoothscroll
   1135      let ns = nvim_create_namespace('')
   1136      call nvim_buf_set_extmark(0, ns, 0, 0, {'virt_lines':[[['virt_below1']]]})
   1137      call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_above1']]],'virt_lines_above':1})
   1138      call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_below2']]]})
   1139      call nvim_buf_set_extmark(0, ns, 2, 0, {'virt_lines':[[['virt_above2']]],'virt_lines_above':1})
   1140      norm ggL
   1141    ]=])
   1142    screen:expect([[
   1143      Line with some text with some text with some text with |
   1144      some text with some text with some text with some text |
   1145      virt_below1                                            |
   1146      virt_above1                                            |
   1147      ^Line with some text with some text with some text with |
   1148      some text with some text with some text with some text |
   1149                                                             |
   1150    ]])
   1151    feed('<C-E>')
   1152    screen:expect([[
   1153      {1:<<<}e text with some text with some text with some text |
   1154      virt_below1                                            |
   1155      virt_above1                                            |
   1156      ^Line with some text with some text with some text with |
   1157      some text with some text with some text with some text |
   1158      virt_below2                                            |
   1159                                                             |
   1160    ]])
   1161    feed('<C-E>')
   1162    screen:expect([[
   1163      virt_below1                                            |
   1164      virt_above1                                            |
   1165      ^Line with some text with some text with some text with |
   1166      some text with some text with some text with some text |
   1167      virt_below2                                            |
   1168      virt_above2                                            |
   1169                                                             |
   1170    ]])
   1171    feed('<C-E>')
   1172    screen:expect([[
   1173      virt_above1                                            |
   1174      ^Line with some text with some text with some text with |
   1175      some text with some text with some text with some text |
   1176      virt_below2                                            |
   1177      virt_above2                                            |
   1178      Line with some text with some text with some text wi{1:@@@}|
   1179                                                             |
   1180    ]])
   1181    feed('<C-E>')
   1182    screen:expect([[
   1183      ^Line with some text with some text with some text with |
   1184      some text with some text with some text with some text |
   1185      virt_below2                                            |
   1186      virt_above2                                            |
   1187      Line with some text with some text with some text with |
   1188      some text with some text with some text with some text |
   1189                                                             |
   1190    ]])
   1191    feed('<C-E>')
   1192    screen:expect([[
   1193      {1:<<<}e text with some text with some text with some tex^t |
   1194      virt_below2                                            |
   1195      virt_above2                                            |
   1196      Line with some text with some text with some text with |
   1197      some text with some text with some text with some text |
   1198      {1:~                                                      }|
   1199                                                             |
   1200    ]])
   1201  end)
   1202 
   1203  it('<<< marker shows with tabline, winbar and splits', function()
   1204    screen:try_resize(40, 12)
   1205    screen:add_extra_attr_ids {
   1206      [100] = { foreground = Screen.colors.Magenta1, bold = true },
   1207    }
   1208    exec([[
   1209      call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
   1210      set smoothscroll scrolloff=0
   1211      norm sj
   1212    ]])
   1213    screen:expect([[
   1214      {1:<<<}e text with some text with some text |
   1215      with some text with some text           |
   1216      Line with some text with some text with |
   1217      some text with some text with some text |
   1218      with some text with some text           |
   1219      {2:[No Name] [+]                           }|
   1220      {1:<<<}e text with some text with some text |
   1221      ^with some text with some text           |
   1222      Line with some text with some text with |
   1223      some text with some text with some te{1:@@@}|
   1224      {3:[No Name] [+]                           }|
   1225                                              |
   1226    ]])
   1227    exec('set showtabline=2')
   1228    feed('<C-E>')
   1229    screen:expect([[
   1230      {5: }{100:2}{5:+ [No Name] }{2:                          }|
   1231      {1:<<<}e text with some text with some text |
   1232      with some text with some text           |
   1233      Line with some text with some text with |
   1234      some text with some text with some text |
   1235      with some text with some text           |
   1236      {2:[No Name] [+]                           }|
   1237      {1:<<<}e text with some text with some text |
   1238      ^with some text with some text           |
   1239      Line with some text with some text wi{1:@@@}|
   1240      {3:[No Name] [+]                           }|
   1241                                              |
   1242    ]])
   1243    exec('set winbar=winbar')
   1244    feed('<C-w>k<C-E>')
   1245    screen:expect([[
   1246      {5: }{100:2}{5:+ [No Name] }{2:                          }|
   1247      {5:winbar                                  }|
   1248      {1:<<<}e text with some text with some text |
   1249      ^with some text with some text           |
   1250      Line with some text with some text with |
   1251      some text with some text with some te{1:@@@}|
   1252      {3:[No Name] [+]                           }|
   1253      {5:winbar                                  }|
   1254      {1:<<<}e text with some text with some text |
   1255      with some text with some text           |
   1256      {2:[No Name] [+]                           }|
   1257                                              |
   1258    ]])
   1259  end)
   1260 
   1261  it('works with very long line', function()
   1262    exec([[
   1263      edit test/functional/fixtures/bigfile_oneline.txt
   1264      setlocal smoothscroll number
   1265    ]])
   1266    screen:expect([[
   1267      {8:  1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;|
   1268      {8:    }; 0001;<control>;Cc;0;BN;;;;;N;START|
   1269      {8:    } OF HEADING;;;; 0002;<control>;Cc;0;|
   1270      {8:    }BN;;;;;N;START OF TEXT;;;; 0003;<con|
   1271      {8:    }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
   1272      {8:    }0004;<control>;Cc;0;BN;;;;;N;END OF |
   1273      {8:    }TRANSMISSION;;;; 0005;<control>;Cc;0|
   1274      {8:    };BN;;;;;N;ENQUIRY;;;; 0006;<control>|
   1275      {8:    };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;|
   1276      {8:    }<control>;Cc;0;BN;;;;;N;BELL;;;; 000|
   1277      {8:    }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;|
   1278                                              |
   1279    ]])
   1280    feed('j')
   1281    screen:expect([[
   1282      {1:<<<}{8: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo|
   1283      {8:    };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA|
   1284      {8:    }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228|
   1285      {8:    };;;;N;;;;; 2F921;CJK COMPATIBILITY I|
   1286      {8:    }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;|
   1287      {8:    } 2F922;CJK COMPATIBILITY IDEOGRAPH-2|
   1288      {8:    }F922;Lo;0;L;7250;;;;N;;;;;          |
   1289      {8:  2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F|
   1290      {8:    }923;Lo;0;L;24608;;;;N;;;;;          |
   1291      {8:  3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F|
   1292      {8:    }924;Lo;0;L;7280;;;;N;;;;;           |
   1293                                              |
   1294    ]])
   1295  end)
   1296 
   1297  it('works with very long line and scrolloff', function()
   1298    screen:try_resize(40, 8)
   1299    exec([[
   1300      set smoothscroll scrolloff=3
   1301      call setline(1, ['one', 'two long '->repeat(100), 'three', 'four', 'five', 'six'])
   1302    ]])
   1303    feed(':norm j721|<CR>')
   1304    screen:expect([[
   1305      {1:<<<}two long two long two long two long t|
   1306      wo long two long two long two long two l|
   1307      ong two long two long two long two long |
   1308      ^two long two long two long two long two |
   1309      long two long two long two long two long|
   1310       two long two long two long two long two|
   1311       long two long two long two long two lon|
   1312      :norm j721|                             |
   1313    ]])
   1314    feed('gj')
   1315    screen:expect([[
   1316      {1:<<<}two long two long two long two long t|
   1317      wo long two long two long two long two l|
   1318      ong two long two long two long two long |
   1319      two long two long two long two long two |
   1320      ^long two long two long two long two long|
   1321       two long two long two long two long two|
   1322       long two long two long two long two lon|
   1323      :norm j721|                             |
   1324    ]])
   1325    feed('gj')
   1326    screen:expect([[
   1327      {1:<<<}long two long two long two long two l|
   1328      ong two long two long two long two long |
   1329      two long two long two long two long two |
   1330      long two long two long two long two long|
   1331      ^ two long two long two long two long two|
   1332       long two long two long two long two lon|
   1333      g two long two long                     |
   1334      :norm j721|                             |
   1335    ]])
   1336    feed('gj')
   1337    screen:expect([[
   1338      {1:<<<}long two long two long two long two l|
   1339      ong two long two long two long two long |
   1340      two long two long two long two long two |
   1341      long two long two long two long two long|
   1342       two long two long two long two long two|
   1343      ^ long two long two long two long two lon|
   1344      g two long two long                     |
   1345      :norm j721|                             |
   1346    ]])
   1347    feed('gj')
   1348    screen:expect([[
   1349      {1:<<<}long two long two long two long two l|
   1350      ong two long two long two long two long |
   1351      two long two long two long two long two |
   1352      long two long two long two long two long|
   1353       two long two long two long two long two|
   1354       long two long two long two long two lon|
   1355      ^g two long two long                     |
   1356      :norm j721|                             |
   1357    ]])
   1358    feed('gj')
   1359    screen:expect([[
   1360      {1:<<<} long two long two long two long two |
   1361      long two long two long two long two long|
   1362       two long two long two long two long two|
   1363       long two long two long two long two lon|
   1364      g two long two long                     |
   1365      ^three                                   |
   1366      four                                    |
   1367      :norm j721|                             |
   1368    ]])
   1369    feed('gk')
   1370    screen:expect([[
   1371      {1:<<<}long two long two long two long two l|
   1372      ong two long two long two long two long |
   1373      two long two long two long two long two |
   1374      long two long two long two long two long|
   1375       two long two long two long two long two|
   1376       long two long two long two long two lon|
   1377      ^g two long two long                     |
   1378      :norm j721|                             |
   1379    ]])
   1380  end)
   1381 end)