diff options
author | glepnir <glephunter@gmail.com> | 2024-09-07 20:41:20 +0800 |
---|---|---|
committer | glepnir <glephunter@gmail.com> | 2024-09-10 13:31:42 +0800 |
commit | 8e81212e151a4e20cff33931b95279e14c4e21c2 (patch) | |
tree | 17cf0867333de5b2bc0dbeffbbd9039a770ee897 /test/functional/ui/float_spec.lua | |
parent | b6e350a6b4df40fcc99931c460668c36fadc9989 (diff) | |
download | rneovim-8e81212e151a4e20cff33931b95279e14c4e21c2.tar.gz rneovim-8e81212e151a4e20cff33931b95279e14c4e21c2.tar.bz2 rneovim-8e81212e151a4e20cff33931b95279e14c4e21c2.zip |
fix(highlight): floating windows inherit NormalFloat from global-ns
Problem:
floating windows did not correctly inherit the NormalFloat highlight
group from the global namespace when it was not defined in the window-specific
namespace. This led to floating windows losing their background highlight when
switching between namespaces.
Solution:
Updated the window highlight logic in update_window_hl() to handle the fallback.
This fix resolves issues with floating window backgrounds not displaying as expected
in certain namespace configurations.
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 754f0772f6..409cf5aac4 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1344,6 +1344,53 @@ describe('float window', function() | ]]) end + + -- + -- floating windows inherit NormalFloat from global-ns. + -- + command('fclose') + command('hi NormalFloat guibg=LightRed') + api.nvim_open_win(0, false, { relative = 'win', row = 3, col = 3, width = 12, height = 3, style = 'minimal' }) + api.nvim_set_hl_ns(api.nvim_create_namespace('test1')) + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:----------------------------------------]|*6 + [3:----------------------------------------]| + ## grid 2 + {14: 1 }^x | + {14: 2 }y | + {14: 3 } | + {0:~ }|*3 + ## grid 3 + | + ## grid 5 + {22:x }| + {22:y }| + {22: }| + ]], float_pos={ + [5] = {1002, "NW", 2, 3, 3, true, 50}; + }, win_viewport={ + [2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + }, win_viewport_margins={ + [2] = { bottom = 0, left = 0, right = 0, top = 0, win = 1000 }, + [5] = { bottom = 0, left = 0, right = 0, top = 0, win = 1002 } + }}) + else + screen:expect({ + grid = [[ + {14: 1 }^x | + {14: 2 }y | + {14: 3 } | + {0:~ }{22:x }{0: }| + {0:~ }{22:y }{0: }| + {0:~ }{22: }{0: }| + | + ]] + }) + end end) it("can use 'minimal' style", function() |