robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.8 KiB66 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3local Screen = require('test.functional.ui.screen')
4
5local describe, before_each, pending = t.describe, t.before_each, t.pending
6local clear, eq, api = n.clear, t.eq, n.api
7local command, fn = n.command, n.fn
8local feed = n.feed
9
10describe('screenrow() and screencol() function', function()
11  local function with_ext_multigrid(multigrid)
12    before_each(function()
13      clear()
14      Screen.new(41, 41, { ext_multigrid = multigrid })
15    end)
16
17    pending('works in floating window', function()
18      local opts = {
19        relative = 'editor',
20        height = 8,
21        width = 12,
22        row = 6,
23        col = 8,
24        anchor = 'NW',
25        style = 'minimal',
26        border = 'none',
27        focusable = 1,
28      }
29      local float = api.nvim_open_win(api.nvim_create_buf(false, true), false, opts)
30
31      api.nvim_set_current_win(float)
32      command('redraw')
33
34      eq(7, fn.screenrow())
35      eq(9, fn.screencol())
36    end)
37
38    pending('works in vertical split', function()
39      command('vsplit')
40      command('wincmd l') -- move to right split
41      feed('iA<CR>BC<ESC>') -- insert two lines
42      command('redraw')
43
44      eq(2, fn.screenrow())
45      eq(23, fn.screencol()) -- 20 (left) | 1 (border) | 2 (2nd col)
46    end)
47
48    pending('works in horizontal split', function()
49      command('split')
50      command('wincmd j') -- move to bottom split
51      feed('iA<CR>BC<ESC>') -- insert two lines
52      command('redraw')
53
54      eq(22, fn.screenrow()) -- 19 (top) | 1 (border) | 2 (2nd row) + 17 (rest) | 2 (cmd)
55      eq(2, fn.screencol())
56    end)
57  end
58
59  describe('with ext_multigrid', function()
60    with_ext_multigrid(true)
61  end)
62
63  describe('without ext_multigrid', function()
64    with_ext_multigrid(false)
65  end)
66end)