mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #7862 'fix resize-related segfaults'
This commit is contained in:
commit
1c6e956079
@ -500,7 +500,7 @@ static void final_column_wrap(UI *ui)
|
|||||||
UGrid *grid = &data->grid;
|
UGrid *grid = &data->grid;
|
||||||
if (grid->col == ui->width) {
|
if (grid->col == ui->width) {
|
||||||
grid->col = 0;
|
grid->col = 0;
|
||||||
if (grid->row < ui->height) {
|
if (grid->row < MIN(ui->height, grid->height - 1)) {
|
||||||
grid->row++;
|
grid->row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ static void destroy_cells(UGrid *grid)
|
|||||||
xfree(grid->cells[i]);
|
xfree(grid->cells[i]);
|
||||||
}
|
}
|
||||||
xfree(grid->cells);
|
xfree(grid->cells);
|
||||||
|
grid->cells = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,15 +6,18 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local thelpers = require('test.functional.terminal.helpers')
|
local thelpers = require('test.functional.terminal.helpers')
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local feed_data = thelpers.feed_data
|
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
|
local feed_data = thelpers.feed_data
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
|
local command = helpers.command
|
||||||
|
local eval = helpers.eval
|
||||||
local nvim_dir = helpers.nvim_dir
|
local nvim_dir = helpers.nvim_dir
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local nvim_prog = helpers.nvim_prog
|
local nvim_prog = helpers.nvim_prog
|
||||||
local nvim_set = helpers.nvim_set
|
local nvim_set = helpers.nvim_set
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
local read_file = helpers.read_file
|
local read_file = helpers.read_file
|
||||||
|
local wait = helpers.wait
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
@ -40,6 +43,28 @@ describe('tui', function()
|
|||||||
screen:detach()
|
screen:detach()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('rapid resize #7572 #7628', function()
|
||||||
|
-- Need buffer rows to provoke the behavior.
|
||||||
|
feed_data(":edit test/functional/fixtures/bigfile.txt:")
|
||||||
|
command('call jobresize(b:terminal_job_id, 58, 9)')
|
||||||
|
command('call jobresize(b:terminal_job_id, 62, 13)')
|
||||||
|
command('call jobresize(b:terminal_job_id, 100, 42)')
|
||||||
|
command('call jobresize(b:terminal_job_id, 37, 1000)')
|
||||||
|
-- Resize to <5 columns.
|
||||||
|
screen:try_resize(4, 44)
|
||||||
|
command('call jobresize(b:terminal_job_id, 4, 1000)')
|
||||||
|
-- Resize to 1 row, then to 1 column, then increase rows to 4.
|
||||||
|
screen:try_resize(44, 1)
|
||||||
|
command('call jobresize(b:terminal_job_id, 44, 1)')
|
||||||
|
screen:try_resize(1, 1)
|
||||||
|
command('call jobresize(b:terminal_job_id, 1, 1)')
|
||||||
|
screen:try_resize(1, 4)
|
||||||
|
command('call jobresize(b:terminal_job_id, 1, 4)')
|
||||||
|
screen:try_resize(57, 17)
|
||||||
|
command('call jobresize(b:terminal_job_id, 57, 17)')
|
||||||
|
eq(2, eval("1+1")) -- Still alive?
|
||||||
|
end)
|
||||||
|
|
||||||
it('accepts basic utf-8 input', function()
|
it('accepts basic utf-8 input', function()
|
||||||
feed_data('iabc\ntest1\ntest2')
|
feed_data('iabc\ntest1\ntest2')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -448,7 +473,7 @@ describe("tui 't_Co' (terminal colors)", function()
|
|||||||
nvim_set))
|
nvim_set))
|
||||||
|
|
||||||
feed_data(":echo &t_Co\n")
|
feed_data(":echo &t_Co\n")
|
||||||
helpers.wait()
|
wait()
|
||||||
local tline
|
local tline
|
||||||
if maxcolors == 8 or maxcolors == 16 then
|
if maxcolors == 8 or maxcolors == 16 then
|
||||||
tline = "~ "
|
tline = "~ "
|
||||||
|
Loading…
Reference in New Issue
Block a user