mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #22233 from zeertzjq/resize-screenclear
fix(ui): make sure screen is valid after resizing
This commit is contained in:
commit
89722ddfac
@ -645,6 +645,8 @@ void remote_ui_grid_resize(UI *ui, Integer grid, Integer width, Integer height)
|
||||
Array args = data->call_buf;
|
||||
if (ui->ui_ext[kUILinegrid]) {
|
||||
ADD_C(args, INTEGER_OBJ(grid));
|
||||
} else {
|
||||
data->client_col = -1; // force cursor update
|
||||
}
|
||||
ADD_C(args, INTEGER_OBJ(width));
|
||||
ADD_C(args, INTEGER_OBJ(height));
|
||||
|
@ -318,6 +318,10 @@ void screen_resize(int width, int height)
|
||||
resizing_autocmd = false;
|
||||
redraw_all_later(UPD_CLEAR);
|
||||
|
||||
if (State != MODE_ASKMORE && State != MODE_EXTERNCMD && State != MODE_CONFIRM) {
|
||||
screenclear();
|
||||
}
|
||||
|
||||
if (starting != NO_SCREEN) {
|
||||
maketitle();
|
||||
|
||||
|
@ -61,6 +61,7 @@ local function screen_tests(linegrid)
|
||||
[5] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Fuchsia},
|
||||
[6] = {bold = true, foreground = Screen.colors.Fuchsia},
|
||||
[7] = {bold = true, foreground = Screen.colors.SeaGreen},
|
||||
[8] = {foreground = Screen.colors.White, background = Screen.colors.Red},
|
||||
} )
|
||||
end)
|
||||
|
||||
@ -866,12 +867,9 @@ local function screen_tests(linegrid)
|
||||
end)
|
||||
|
||||
describe('resize', function()
|
||||
before_each(function()
|
||||
it('rebuilds the whole screen', function()
|
||||
screen:try_resize(25, 5)
|
||||
feed('iresize')
|
||||
end)
|
||||
|
||||
it('rebuilds the whole screen', function()
|
||||
screen:expect([[
|
||||
resize^ |
|
||||
{0:~ }|
|
||||
@ -882,6 +880,7 @@ local function screen_tests(linegrid)
|
||||
end)
|
||||
|
||||
it('has minimum width/height values', function()
|
||||
feed('iresize')
|
||||
screen:try_resize(1, 1)
|
||||
screen:expect([[
|
||||
resize^ |
|
||||
@ -896,7 +895,8 @@ local function screen_tests(linegrid)
|
||||
end)
|
||||
|
||||
it('VimResized autocommand does not cause invalid UI events #20692 #20759', function()
|
||||
feed('<Esc>')
|
||||
screen:try_resize(25, 5)
|
||||
feed('iresize<Esc>')
|
||||
command([[autocmd VimResized * redrawtabline]])
|
||||
command([[autocmd VimResized * lua vim.api.nvim_echo({ { 'Hello' } }, false, {})]])
|
||||
command([[autocmd VimResized * let g:echospace = v:echospace]])
|
||||
@ -919,6 +919,77 @@ local function screen_tests(linegrid)
|
||||
]])
|
||||
eq(29, meths.get_var('echospace'))
|
||||
end)
|
||||
|
||||
it('messages from the same Ex command as resize are visible #22225', function()
|
||||
feed(':set columns=20 | call<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{1: }|
|
||||
{8:E471: Argument requi}|
|
||||
{8:red} |
|
||||
{7:Press ENTER or type }|
|
||||
{7:command to continue}^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
feed(':set columns=0<CR>')
|
||||
screen:expect([[
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{1: }|
|
||||
{8:E594: Need a}|
|
||||
{8:t least 12 c}|
|
||||
{8:olumns: colu}|
|
||||
{8:mns=0} |
|
||||
{7:Press ENTER }|
|
||||
{7:or type comm}|
|
||||
{7:and to conti}|
|
||||
{7:nue}^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('press enter', function()
|
||||
|
Loading…
Reference in New Issue
Block a user