Merge pull request #22085 from neovim/backport-21000-to-release-0.8

[Backport release-0.8] fix(messages): reset msg_grid_scroll_discount when redrawing
This commit is contained in:
zeertzjq 2023-02-01 20:09:21 +08:00 committed by GitHub
commit b49f5c7882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -518,6 +518,7 @@ int update_screen(int type)
} }
msg_scrolled = 0; msg_scrolled = 0;
msg_scrolled_at_flush = 0; msg_scrolled_at_flush = 0;
msg_grid_scroll_discount = 0;
need_wait_return = false; need_wait_return = false;
} }

View File

@ -128,7 +128,6 @@ static bool msg_ext_history_visible = false;
static bool msg_ext_keep_after_cmdline = false; static bool msg_ext_keep_after_cmdline = false;
static int msg_grid_pos_at_flush = 0; static int msg_grid_pos_at_flush = 0;
static int msg_grid_scroll_discount = 0;
static void ui_ext_msg_set_pos(int row, bool scrolled) static void ui_ext_msg_set_pos(int row, bool scrolled)
{ {
@ -2458,6 +2457,7 @@ void msg_reset_scroll(void)
} }
msg_scrolled = 0; msg_scrolled = 0;
msg_scrolled_at_flush = 0; msg_scrolled_at_flush = 0;
msg_grid_scroll_discount = 0;
} }
/// Increment "msg_scrolled". /// Increment "msg_scrolled".

View File

@ -66,6 +66,8 @@ EXTERN ScreenGrid msg_grid_adj INIT(= SCREEN_GRID_INIT);
// value of msg_scrolled at latest msg_scroll_flush. // value of msg_scrolled at latest msg_scroll_flush.
EXTERN int msg_scrolled_at_flush INIT(= 0); EXTERN int msg_scrolled_at_flush INIT(= 0);
EXTERN int msg_grid_scroll_discount INIT(= 0);
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "message.h.generated.h" # include "message.h.generated.h"
#endif #endif

View File

@ -10,9 +10,11 @@ local async_meths = helpers.async_meths
local test_build_dir = helpers.test_build_dir local test_build_dir = helpers.test_build_dir
local nvim_prog = helpers.nvim_prog local nvim_prog = helpers.nvim_prog
local iswin = helpers.iswin local iswin = helpers.iswin
local exec = helpers.exec
local exc_exec = helpers.exc_exec local exc_exec = helpers.exc_exec
local exec_lua = helpers.exec_lua local exec_lua = helpers.exec_lua
local poke_eventloop = helpers.poke_eventloop local poke_eventloop = helpers.poke_eventloop
local assert_alive = helpers.assert_alive
describe('ui/ext_messages', function() describe('ui/ext_messages', function()
local screen local screen
@ -1258,6 +1260,17 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim
end) end)
end) end)
it('calling screenstring() after redrawing between messages without UI #20999', function()
clear()
exec([[
echo repeat('a', 100)
redraw
echo "\n"
call screenstring(1, 1)
]])
assert_alive()
end)
describe('ui/ext_messages', function() describe('ui/ext_messages', function()
local screen local screen