aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-07-08 15:16:17 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-09-04 23:57:02 +0200
commitd5162afa2aee6609bf5d4f818639235b70c57a9a (patch)
tree7d0992010b1b1548e3189f46c1aa8b4c5c67cbb6 /test/functional/ui/float_spec.lua
parentd7aea13fee879a5e7854f2ebe9b7321cd8daf84f (diff)
downloadrneovim-d5162afa2aee6609bf5d4f818639235b70c57a9a.tar.gz
rneovim-d5162afa2aee6609bf5d4f818639235b70c57a9a.tar.bz2
rneovim-d5162afa2aee6609bf5d4f818639235b70c57a9a.zip
anchor float to buffer position
vim-patch:8.1.1645: cannot use a popup window for a balloon
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua329
1 files changed, 329 insertions, 0 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 958c56334a..c8cf9d830e 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -963,6 +963,335 @@ describe('floating windows', function()
end
end)
+ it('can be placed relative text in a window', function()
+ screen:try_resize(30,5)
+ local firstwin = meths.get_current_win().id
+ meths.buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ ^just some |
+ example text that is wider tha|
+ n the window |
+ |
+ ## grid 3
+ |
+ ]]}
+ else
+ screen:expect{grid=[[
+ ^just some |
+ example text that is wider tha|
+ n the window |
+ |
+ |
+ ]]}
+ end
+
+ local buf = meths.create_buf(false,false)
+ meths.buf_set_lines(buf, 0, -1, true, {'some info!'})
+
+ local win = meths.open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ ^just some |
+ example text that is wider tha|
+ n the window |
+ |
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 3, 2, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^just some |
+ example text that is wider tha|
+ n the window |
+ {1:some info! } |
+ |
+ ]]}
+ end
+ eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW',
+ external=false, col=0, row=1, win=firstwin, focusable=true}, meths.win_get_config(win))
+
+ feed('<c-e>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ ^example text that is wider tha|
+ n the window |
+ |
+ |
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 2, 2, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^example text that is wider tha|
+ n the window |
+ {1:some info! } |
+ |
+ |
+ ]]}
+ end
+
+
+ screen:try_resize(45,5)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ ^example text that is wider than the window |
+ |
+ |
+ more text |
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 1, 32, true }
+ }}
+ else
+ -- note: appears misalinged due to cursor
+ screen:expect{grid=[[
+ ^example text that is wider than the window |
+ {1:some info! } |
+ |
+ more text |
+ |
+ ]]}
+ end
+
+ screen:try_resize(25,10)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [3:-------------------------]|
+ ## grid 2
+ ^example text that is wide|
+ r than the window |
+ |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 2, 7, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^example text that is wide|
+ r than the window |
+ {1:some info! } |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [3:-------------------------]|
+ ## grid 2
+ ^example text that is wide|
+ r than the window |
+ |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "SW", 2, 1, 7, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^example{1:some info! }s wide|
+ r than the window |
+ |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [3:-------------------------]|
+ ## grid 2
+ ^example text that is wide|
+ r than the window |
+ |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 2, 5, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^example text that is wide|
+ r than the window |
+ {1:some info! } |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {relative='win', bufpos={1,32}, row=2})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [3:-------------------------]|
+ ## grid 2
+ ^example text that is wide|
+ r than the window |
+ |
+ |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:some info! }|
+ ]], float_pos={
+ [5] = { {
+ id = 1002
+ }, "NW", 2, 3, 7, true }
+ }}
+ else
+ screen:expect{grid=[[
+ ^example text that is wide|
+ r than the window |
+ |
+ {1:some info! } |
+ more text |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+ end)
+
it('validates cursor even when window is not entered', function()
screen:try_resize(30,5)
command("set nowrap")