diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-12-16 12:41:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 12:41:43 +0100 |
commit | a402b5e2d58c53f0343e5b01ddf9caca961f30ab (patch) | |
tree | dcbbf911e5a8061bdaaff2e28a93816e73405b92 /test/functional/vimscript/screenpos_spec.lua | |
parent | 326e74571be43823ded9fa805a3173bdabda6bec (diff) | |
parent | ffe3003e02b370936542df7d07bad073733a84b0 (diff) | |
download | rneovim-a402b5e2d58c53f0343e5b01ddf9caca961f30ab.tar.gz rneovim-a402b5e2d58c53f0343e5b01ddf9caca961f30ab.tar.bz2 rneovim-a402b5e2d58c53f0343e5b01ddf9caca961f30ab.zip |
Merge pull request #16134 from zeertzjq/screenpos-border
fix(screenpos, float): add top and left border adjustment
Diffstat (limited to 'test/functional/vimscript/screenpos_spec.lua')
-rw-r--r-- | test/functional/vimscript/screenpos_spec.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/functional/vimscript/screenpos_spec.lua b/test/functional/vimscript/screenpos_spec.lua new file mode 100644 index 0000000000..75e5c02298 --- /dev/null +++ b/test/functional/vimscript/screenpos_spec.lua @@ -0,0 +1,51 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear, eq, meths = helpers.clear, helpers.eq, helpers.meths +local command, funcs = helpers.command, helpers.funcs + +before_each(clear) + +describe('screenpos() function', function() + it('works in floating window with border', function() + local bufnr = meths.create_buf(false, true) + local opts = { + relative='editor', + height=8, + width=12, + row=6, + col=8, + anchor='NW', + style='minimal', + border='none', + focusable=1 + } + local float = meths.open_win(bufnr, false, opts) + command('redraw') + local pos = funcs.screenpos(bufnr, 1, 1) + eq(7, pos.row) + eq(9, pos.col) + + -- only left border + opts.border = {'', '', '', '', '', '', '', '|'} + meths.win_set_config(float, opts) + command('redraw') + pos = funcs.screenpos(bufnr, 1, 1) + eq(7, pos.row) + eq(10, pos.col) + + -- only top border + opts.border = {'', '_', '', '', '', '', '', ''} + meths.win_set_config(float, opts) + command('redraw') + pos = funcs.screenpos(bufnr, 1, 1) + eq(8, pos.row) + eq(9, pos.col) + + -- both left and top border + opts.border = 'single' + meths.win_set_config(float, opts) + command('redraw') + pos = funcs.screenpos(bufnr, 1, 1) + eq(8, pos.row) + eq(10, pos.col) + end) +end) |