mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
fix(window): crash on negative window height with 'winbar' #33250
Problem: Negative window and grid height with 'winbar'.
Solution: Clamp the height when subtracting the 'winbar' height.
(cherry picked from commit 0e7479bb76
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
f68e0fed26
commit
a4b6705e87
@@ -6634,7 +6634,7 @@ void win_set_inner_size(win_T *wp, bool valid_cursor)
|
|||||||
int prev_height = wp->w_height_inner;
|
int prev_height = wp->w_height_inner;
|
||||||
int height = wp->w_height_request;
|
int height = wp->w_height_request;
|
||||||
if (height == 0) {
|
if (height == 0) {
|
||||||
height = wp->w_height - wp->w_winbar_height;
|
height = MAX(0, wp->w_height - wp->w_winbar_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height != prev_height) {
|
if (height != prev_height) {
|
||||||
|
@@ -540,6 +540,15 @@ describe('winbar', function()
|
|||||||
]])
|
]])
|
||||||
eq('Vim(set):E36: Not enough room', pcall_err(command, 'set winbar=test'))
|
eq('Vim(set):E36: Not enough room', pcall_err(command, 'set winbar=test'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not crash due to negative grid height #33176', function()
|
||||||
|
screen:try_resize(screen._width, 20)
|
||||||
|
command('botright split | belowright vsplit | 2wincmd w')
|
||||||
|
api.nvim_set_option_value('winfixheight', true, { scope = 'local', win = 0 })
|
||||||
|
api.nvim_win_set_height(0, 8)
|
||||||
|
feed('q:')
|
||||||
|
n.assert_alive()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('local winbar with tabs', function()
|
describe('local winbar with tabs', function()
|
||||||
|
Reference in New Issue
Block a user