aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/107_adjust_window_and_contents_spec.lua
blob: e97c9c074bf63452b514aa0436de35ff7f042dc0 (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
-- Tests for adjusting window and contents

local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')

local poke_eventloop = n.poke_eventloop
local clear = n.clear
local insert = n.insert
local command = n.command

describe('107', function()
  setup(clear)

  it('is working', function()
    local screen = Screen.new()

    insert('start:')
    poke_eventloop()
    command('new')
    command('call setline(1, range(1,256))')
    command('let r=[]')
    command([[
      func! GetScreenStr(row)
         let str = ""
         for c in range(1,3)
             let str .= nr2char(screenchar(a:row, c))
         endfor
         return str
      endfunc
    ]])
    command([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
    command('let s3=GetScreenStr(1)')
    command('wincmd p')
    command('call add(r, [line("w0"), s3])')
    command([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
    command('let s3=GetScreenStr(1)')
    command('wincmd p')
    command('call add(r, [line("w0"), s3])')
    command([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
    command('let s3=GetScreenStr(1)')
    command(':wincmd p')
    command('call add(r, [line("w0"), s3])')
    command('bwipeout!')
    command('$put=r')
    command('call garbagecollect(1)')

    screen:expect([[
      start:                                               |
      [1, '1  ']                                           |
      [50, '50 ']                                          |
      ^[59, '59 ']                                          |
      {1:~                                                    }|*9
      3 more lines                                         |
    ]])
  end)
end)