aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/tabline_spec.lua
blob: 949bec6dea5f7358029ea0da6ad14ca342493dfa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')

local clear = n.clear
local exec = n.exec
local feed = n.feed

before_each(clear)

describe('tabline', function()
  local screen

  before_each(function()
    screen = Screen.new(50, 7)
  end)

  -- oldtest: Test_tabline_showcmd()
  it('showcmdloc=tabline works', function()
    exec([[
      func MyTabLine()
        return '%S'
      endfunc

      set showcmd
      set showtabline=2
      set tabline=%!MyTabLine()
      set showcmdloc=tabline
      call setline(1, ['a', 'b', 'c'])
      set foldopen+=jump
      1,2fold
      3
    ]])

    feed('g')
    screen:expect([[
      {2:g                                                 }|
      {13:+--  2 lines: a···································}|
      ^c                                                 |
      {1:~                                                 }|*3
                                                        |
    ]])

    -- typing "gg" should open the fold
    feed('g')
    screen:expect([[
      {2:                                                  }|
      ^a                                                 |
      b                                                 |
      c                                                 |
      {1:~                                                 }|*2
                                                        |
    ]])

    feed('<C-V>Gl')
    screen:expect([[
      {2:3x2                                               }|
      {17:a}                                                 |
      {17:b}                                                 |
      {17:c}^                                                 |
      {1:~                                                 }|*2
      {5:-- VISUAL BLOCK --}                                |
    ]])

    feed('<Esc>1234')
    screen:expect([[
      {2:1234                                              }|
      a                                                 |
      b                                                 |
      ^c                                                 |
      {1:~                                                 }|*2
                                                        |
    ]])

    feed('<Esc>:set tabline=<CR>')
    feed(':<CR>')
    feed('1234')
    screen:expect([[
      {5: + [No Name] }{2:                           }{24:1234}{2:      }|
      a                                                 |
      b                                                 |
      ^c                                                 |
      {1:~                                                 }|*2
      :                                                 |
    ]])
  end)
end)