mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(float): fix crash with bufpos and non-existent window (#21319)
This commit is contained in:
@@ -843,8 +843,6 @@ void win_config_float(win_T *wp, FloatConfig fconfig)
|
|||||||
grid_adjust(&grid, &row_off, &col_off);
|
grid_adjust(&grid, &row_off, &col_off);
|
||||||
row += row_off;
|
row += row_off;
|
||||||
col += col_off;
|
col += col_off;
|
||||||
}
|
|
||||||
api_clear_error(&dummy);
|
|
||||||
if (wp->w_float_config.bufpos.lnum >= 0) {
|
if (wp->w_float_config.bufpos.lnum >= 0) {
|
||||||
pos_T pos = { wp->w_float_config.bufpos.lnum + 1,
|
pos_T pos = { wp->w_float_config.bufpos.lnum + 1,
|
||||||
wp->w_float_config.bufpos.col, 0 };
|
wp->w_float_config.bufpos.col, 0 };
|
||||||
@@ -853,6 +851,8 @@ void win_config_float(win_T *wp, FloatConfig fconfig)
|
|||||||
row += trow - 1;
|
row += trow - 1;
|
||||||
col += tcol - 1;
|
col += tcol - 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
api_clear_error(&dummy);
|
||||||
wp->w_winrow = row;
|
wp->w_winrow = row;
|
||||||
wp->w_wincol = col;
|
wp->w_wincol = col;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -391,6 +391,15 @@ describe('float window', function()
|
|||||||
eq(winids, eval('winids'))
|
eq(winids, eval('winids'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('no crash with bufpos and non-existent window', function()
|
||||||
|
command('new')
|
||||||
|
local closed_win = meths.get_current_win().id
|
||||||
|
command('close')
|
||||||
|
local buf = meths.create_buf(false,false)
|
||||||
|
meths.open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}})
|
||||||
|
assert_alive()
|
||||||
|
end)
|
||||||
|
|
||||||
it("no segfault when setting minimal style after clearing local 'fillchars' #19510", function()
|
it("no segfault when setting minimal style after clearing local 'fillchars' #19510", function()
|
||||||
local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1}
|
local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1}
|
||||||
local float_win = meths.open_win(0, true, float_opts)
|
local float_win = meths.open_win(0, true, float_opts)
|
||||||
|
Reference in New Issue
Block a user