aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2025-01-27 23:52:27 +0800
committerGitHub <noreply@github.com>2025-01-27 07:52:27 -0800
commitbe01b361d8ff0e8bf8f93cdf4e4f1055ecd341c2 (patch)
tree48941be937399ee9505e2d1b348c20fffcae6315 /test/functional/ui/float_spec.lua
parentc1718d68634460117ef5731643669d59587ec628 (diff)
downloadrneovim-be01b361d8ff0e8bf8f93cdf4e4f1055ecd341c2.tar.gz
rneovim-be01b361d8ff0e8bf8f93cdf4e4f1055ecd341c2.tar.bz2
rneovim-be01b361d8ff0e8bf8f93cdf4e4f1055ecd341c2.zip
fix(float): cannot set title/footer independently #31993
Problem: `nvim_win_set_config` cannot set the title and footer independently. When only one is given, the other is reset to the default of "left". Solution: Reuse existing title/footer value if not provided.
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua169
1 files changed, 149 insertions, 20 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 27ab0feb9c..15231e0f8c 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -2333,6 +2333,61 @@ describe('float window', function()
|
]]}
end
+
+ -- reuse before title pos
+ api.nvim_win_set_config(win, {title= 'new'})
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------------------------------]|*6
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|*5
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔══════}{11:new}{5:╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═════════╝}|
+ ]],
+ float_pos = {
+ [4] = {1001, "NW", 1, 2, 5, true, 50};
+ },
+ win_viewport = {
+ [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ },
+ win_viewport_margins = {
+ [2] = {
+ bottom = 0,
+ left = 0,
+ right = 0,
+ top = 0,
+ win = 1000
+ },
+ [4] = {
+ bottom = 1,
+ left = 1,
+ right = 1,
+ top = 1,
+ win = 1001
+ }
+ },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔══════}{11:new}{5:╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═════════╝}{0: }|
+ |
+ ]])
+ end
end)
it('border with footer', function()
@@ -2478,6 +2533,61 @@ describe('float window', function()
|
]]}
end
+
+ -- reuse before footer pos
+ api.nvim_win_set_config(win, { footer = 'new' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------------------------------]|*6
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|*5
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚══════}{11:new}{5:╝}|
+ ]],
+ float_pos = {
+ [4] = {1001, "NW", 1, 2, 5, true, 50};
+ },
+ win_viewport = {
+ [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ },
+ win_viewport_margins = {
+ [2] = {
+ bottom = 0,
+ left = 0,
+ right = 0,
+ top = 0,
+ win = 1000
+ },
+ [4] = {
+ bottom = 1,
+ left = 1,
+ right = 1,
+ top = 1,
+ win = 1001
+ }
+ },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚══════}{11:new}{5:╝}{0: }|
+ |
+ ]])
+ end
end)
it('border with title and footer', function()
@@ -8710,38 +8820,58 @@ describe('float window', function()
## grid 3
|
## grid 4
- {5:╔}{11:win_100}{5:═════════════╗}|
+ {5:╔══════}{11:win_100}{5:═══════╗}|
{5:║}{7: }{5:║}|
{5:║}{7:~ }{5:║}|*2
{5:╚════════════════════╝}|
## grid 6
- {5:┌}{11:win_150}{5:─────────────┐}|
+ {5:┌──────}{11:win_150}{5:───────┐}|
{5:│}{8: }{5:│}|
{5:│}{8:~ }{5:│}|*2
{5:└────────────────────┘}|
- ]], float_pos={
+ ]],
+ float_pos = {
[4] = {1001, "NW", 1, 1, 5, true, 100};
[6] = {1003, "NW", 1, 3, 7, true, 150};
- }, win_viewport={
+ },
+ win_viewport = {
[2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[6] = {win = 1003, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
- }, win_viewport_margins={
- [2] = { bottom = 0, left = 0, right = 0, top = 0, win = 1000 },
- [4] = { bottom = 1, left = 1, right = 1, top = 1, win = 1001 },
- [6] = { bottom = 1, left = 1, right = 1, top = 1, win = 1003 }
- }})
- else
- screen:expect({
- grid = [[
- ^ |
- {0:~ }{5:╔}{11:w}{5:┌}{11:win_150}{5:─────────────┐}{0: }|
- {0:~ }{5:║}{7: }{5:│}{8: }{5:│}{0: }|
- {0:~ }{5:║}{7:~}{5:│}{8:~ }{5:│}{0: }|*2
- {0:~ }{5:╚═└────────────────────┘}{0: }|
- |
- ]]
+ },
+ win_viewport_margins = {
+ [2] = {
+ bottom = 0,
+ left = 0,
+ right = 0,
+ top = 0,
+ win = 1000
+ },
+ [4] = {
+ bottom = 1,
+ left = 1,
+ right = 1,
+ top = 1,
+ win = 1001
+ },
+ [6] = {
+ bottom = 1,
+ left = 1,
+ right = 1,
+ top = 1,
+ win = 1003
+ }
+ },
})
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }{5:╔═┌──────}{11:win_150}{5:───────┐}{0: }|
+ {0:~ }{5:║}{7: }{5:│}{8: }{5:│}{0: }|
+ {0:~ }{5:║}{7:~}{5:│}{8:~ }{5:│}{0: }|*2
+ {0:~ }{5:╚═└────────────────────┘}{0: }|
+ |
+ ]])
end
end)
@@ -9724,4 +9854,3 @@ describe('float window', function()
with_ext_multigrid(false)
end)
end)
-