neovim

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

tabline_spec.lua (2794B)


      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 
      8 before_each(clear)
      9 
     10 describe('tabline', function()
     11  local screen
     12 
     13  before_each(function()
     14    screen = Screen.new(50, 7)
     15  end)
     16 
     17  -- oldtest: Test_tabline_showcmd()
     18  it('showcmdloc=tabline works', function()
     19    exec([[
     20      func MyTabLine()
     21        return '%S'
     22      endfunc
     23 
     24      set showcmd
     25      set showtabline=2
     26      set tabline=%!MyTabLine()
     27      set showcmdloc=tabline
     28      call setline(1, ['a', 'b', 'c'])
     29      set foldopen+=jump
     30      1,2fold
     31      3
     32    ]])
     33 
     34    feed('g')
     35    screen:expect([[
     36      {2:g                                                 }|
     37      {13:+--  2 lines: a···································}|
     38      ^c                                                 |
     39      {1:~                                                 }|*3
     40                                                        |
     41    ]])
     42 
     43    -- typing "gg" should open the fold
     44    feed('g')
     45    screen:expect([[
     46      {2:                                                  }|
     47      ^a                                                 |
     48      b                                                 |
     49      c                                                 |
     50      {1:~                                                 }|*2
     51                                                        |
     52    ]])
     53 
     54    feed('<C-V>Gl')
     55    screen:expect([[
     56      {2:3x2                                               }|
     57      {17:a}                                                 |
     58      {17:b}                                                 |
     59      {17:c}^                                                 |
     60      {1:~                                                 }|*2
     61      {5:-- VISUAL BLOCK --}                                |
     62    ]])
     63 
     64    feed('<Esc>1234')
     65    screen:expect([[
     66      {2:1234                                              }|
     67      a                                                 |
     68      b                                                 |
     69      ^c                                                 |
     70      {1:~                                                 }|*2
     71                                                        |
     72    ]])
     73 
     74    feed('<Esc>:set tabline=<CR>')
     75    feed(':<CR>')
     76    feed('1234')
     77    screen:expect([[
     78      {5: + [No Name] }{2:                           }{24:1234}{2:      }|
     79      a                                                 |
     80      b                                                 |
     81      ^c                                                 |
     82      {1:~                                                 }|*2
     83      :                                                 |
     84    ]])
     85  end)
     86 end)