neovim

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

107_adjust_window_and_contents_spec.lua (1715B)


      1 -- Tests for adjusting window and contents
      2 
      3 local n = require('test.functional.testnvim')()
      4 local Screen = require('test.functional.ui.screen')
      5 
      6 local poke_eventloop = n.poke_eventloop
      7 local clear = n.clear
      8 local insert = n.insert
      9 local command = n.command
     10 
     11 describe('107', function()
     12  setup(clear)
     13 
     14  it('is working', function()
     15    local screen = Screen.new()
     16 
     17    insert('start:')
     18    poke_eventloop()
     19    command('new')
     20    command('call setline(1, range(1,256))')
     21    command('let r=[]')
     22    command([[
     23      func! GetScreenStr(row)
     24         let str = ""
     25         for c in range(1,3)
     26             let str .= nr2char(screenchar(a:row, c))
     27         endfor
     28         return str
     29      endfunc
     30    ]])
     31    command([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
     32    command('let s3=GetScreenStr(1)')
     33    command('wincmd p')
     34    command('call add(r, [line("w0"), s3])')
     35    command([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
     36    command('let s3=GetScreenStr(1)')
     37    command('wincmd p')
     38    command('call add(r, [line("w0"), s3])')
     39    command([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
     40    command('let s3=GetScreenStr(1)')
     41    command(':wincmd p')
     42    command('call add(r, [line("w0"), s3])')
     43    command('bwipeout!')
     44    command('$put=r')
     45    command('call garbagecollect(1)')
     46 
     47    screen:expect([[
     48      start:                                               |
     49      [1, '1  ']                                           |
     50      [50, '50 ']                                          |
     51      ^[59, '59 ']                                          |
     52      {1:~                                                    }|*9
     53      3 more lines                                         |
     54    ]])
     55  end)
     56 end)