mirror of
https://github.com/neovim/neovim.git
synced 2026-05-24 05:40:08 +00:00
feat(api): use zindex to determine dimmed cursor shape #39054
Problem: The cursor shape is changed to indicate when it is behind an
unfocused floating window (since a2b92a5e). This behavior
cannot be controlled by a floating window that doesn't want
to dim the cursor.
Solution: Assign a zindex-offset of 50 to the zindex of the current
window. To not dim the cursor when creating a floating window
on top of the current window one can assign the zindex
accordingly.
This commit is contained in:
@@ -11622,7 +11622,6 @@ describe('float window', function()
|
||||
row = 8,
|
||||
col = 9,
|
||||
border = 'single',
|
||||
zindex = 1,
|
||||
})
|
||||
local buf2 = api.nvim_create_buf(false, false)
|
||||
local float_win_above = api.nvim_open_win(buf2, false, {
|
||||
@@ -11631,7 +11630,7 @@ describe('float window', function()
|
||||
height = 10,
|
||||
row = 0,
|
||||
col = 0,
|
||||
zindex = 2,
|
||||
zindex = 100,
|
||||
})
|
||||
if multigrid then
|
||||
screen:expect({
|
||||
@@ -11659,8 +11658,8 @@ describe('float window', function()
|
||||
[2] = { height = 19, startcol = 0, startrow = 0, width = 50, win = 1000 },
|
||||
},
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 8, 9, true, 1, 1, 8, 9 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 2, 2, 0, 0 },
|
||||
[7] = { 1004, 'NW', 1, 8, 9, true, 50, 1, 8, 9 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 100, 2, 0, 0 },
|
||||
},
|
||||
mode = 'normal',
|
||||
})
|
||||
@@ -11708,8 +11707,8 @@ describe('float window', function()
|
||||
[2] = { height = 19, startcol = 0, startrow = 0, width = 50, win = 1000 },
|
||||
},
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 9, 8, true, 1, 1, 9, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 2, 2, 0, 0 },
|
||||
[7] = { 1004, 'NW', 1, 9, 8, true, 50, 1, 9, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 100, 2, 0, 0 },
|
||||
},
|
||||
mode = 'normal',
|
||||
})
|
||||
@@ -11759,8 +11758,8 @@ describe('float window', function()
|
||||
[2] = { height = 19, startcol = 0, startrow = 0, width = 50, win = 1000 },
|
||||
},
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 1, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 2, 2, 0, 0 },
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 50, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 100, 2, 0, 0 },
|
||||
},
|
||||
mode = 'normal',
|
||||
})
|
||||
@@ -11809,17 +11808,22 @@ describe('float window', function()
|
||||
[2] = { height = 19, startcol = 0, startrow = 0, width = 50, win = 1000 },
|
||||
},
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 1, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 2, 2, 0, 0 },
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 50, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 100, 2, 0, 0 },
|
||||
},
|
||||
mode = 'normal',
|
||||
})
|
||||
else
|
||||
screen:expect { mode = 'replace' }
|
||||
end
|
||||
-- Not obscured when zindex doesn't exceed the zindex of the current grid + 50 (#37703).
|
||||
api.nvim_win_set_config(float_win_above, { zindex = 99 })
|
||||
if not multigrid then
|
||||
screen:expect { mode = 'normal' }
|
||||
end
|
||||
|
||||
-- Not obscured by a hidden floatwin.
|
||||
api.nvim_win_set_config(float_win_above, { hide = true })
|
||||
api.nvim_win_set_config(float_win_above, { hide = true, zindex = 100 })
|
||||
if multigrid then
|
||||
screen:expect({
|
||||
grid = [[
|
||||
@@ -11843,12 +11847,26 @@ describe('float window', function()
|
||||
{2:~ }|*9
|
||||
]],
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 1, 1, 8, 8 },
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 50, 1, 8, 8 },
|
||||
},
|
||||
mode = 'normal',
|
||||
})
|
||||
else
|
||||
screen:expect { mode = 'normal' }
|
||||
screen:expect({
|
||||
grid = [[
|
||||
one |
|
||||
two |
|
||||
three |
|
||||
{0:~ }|*5
|
||||
{0:~ }{5:┌─────┐}{0: }|
|
||||
{0:~ }{5:│}{1:^ x}{5:│}{0: }|
|
||||
{0:~ }{5:│}{2: ~}{5:│}{0: }|*4
|
||||
{0:~ }{5:└─────┘}{0: }|
|
||||
{0:~ }|*4
|
||||
|
|
||||
]],
|
||||
mode = 'normal',
|
||||
})
|
||||
end
|
||||
|
||||
-- Not obscured in the command-line if curwin's cursor is obscured.
|
||||
@@ -11877,8 +11895,8 @@ describe('float window', function()
|
||||
{2:~ }|*9
|
||||
]],
|
||||
float_pos = {
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 1, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 2, 2, 0, 0 },
|
||||
[7] = { 1004, 'NW', 1, 8, 8, true, 50, 1, 8, 8 },
|
||||
[8] = { 1005, 'NW', 1, 0, 0, true, 100, 2, 0, 0 },
|
||||
},
|
||||
mode = 'cmdline_normal',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user