diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/message.c | 31 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/screen.c | 6 |
3 files changed, 23 insertions, 17 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index b5a5f656a0..1ae2617767 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -150,10 +150,16 @@ void msg_grid_set_pos(int row, bool scrolled) } } +bool msg_use_grid(void) +{ + return default_grid.chars && msg_use_msgsep() + && !ui_has(kUIMessages); +} + void msg_grid_validate(void) { grid_assign_handle(&msg_grid); - bool should_alloc = msg_dothrottle(); + bool should_alloc = msg_use_grid(); if (should_alloc && (msg_grid.Rows != Rows || msg_grid.Columns != Columns || !msg_grid.chars)) { // TODO(bfredl): eventually should be set to "invalid". I e all callers @@ -2027,7 +2033,7 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, // Tricky: if last cell will be written, delay the throttle until // after the first scroll. Otherwise we would need to keep track of it. - if (has_last_char && msg_dothrottle()) { + if (has_last_char && msg_do_throttle()) { if (!msg_grid.throttled) { msg_grid_scroll_discount++; } @@ -2158,12 +2164,6 @@ int msg_scrollsize(void) return msg_scrolled + p_ch + 1; } -bool msg_dothrottle(void) -{ - return default_grid.chars && msg_use_msgsep() - && !ui_has(kUIMessages); -} - bool msg_use_msgsep(void) { // the full-screen scroll behavior doesn't really make sense with @@ -2171,12 +2171,15 @@ bool msg_use_msgsep(void) return ((dy_flags & DY_MSGSEP) || ui_has(kUIMultigrid)); } -/* - * Scroll the screen up one line for displaying the next message line. - */ +bool msg_do_throttle(void) +{ + return msg_use_grid() && !(rdb_flags & RDB_NOTHROTTLE); +} + +/// Scroll the screen up one line for displaying the next message line. void msg_scroll_up(bool may_throttle) { - if (may_throttle && msg_dothrottle()) { + if (may_throttle && msg_do_throttle()) { msg_grid.throttled = true; } msg_did_scroll = true; @@ -2255,7 +2258,7 @@ void msg_reset_scroll(void) } // TODO(bfredl): some duplicate logic with update_screen(). Later on // we should properly disentangle message clear with full screen redraw. - if (msg_dothrottle()) { + if (msg_use_grid()) { msg_grid.throttled = false; // TODO(bfredl): risk for extra flicker i e with // "nvim -o has_swap also_has_swap" @@ -2713,7 +2716,7 @@ static int do_more_prompt(int typed_char) } else { /* First display any text that we scrolled back. */ while (toscroll > 0 && mp_last != NULL) { - if (msg_dothrottle() && !msg_grid.throttled) { + if (msg_do_throttle() && !msg_grid.throttled) { // Tricky: we redraw at one line higher than usual. Therefore // the non-flushed area is one line larger. msg_scrolled_at_flush--; diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index d846bd0ae0..94f98af524 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -518,9 +518,10 @@ EXTERN long p_pyx; // 'pyxversion' EXTERN char_u *p_rdb; // 'redrawdebug' EXTERN unsigned rdb_flags; # ifdef IN_OPTION_C -static char *(p_rdb_values[]) = { "compositor", NULL }; +static char *(p_rdb_values[]) = { "compositor", "nothrottle", NULL }; # endif # define RDB_COMPOSITOR 0x001 +# define RDB_NOTHROTTLE 0x002 EXTERN long p_rdt; // 'redrawtime' EXTERN int p_remap; // 'remap' diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 13eb088813..5bcd2c808d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -404,7 +404,9 @@ int update_screen(int type) default_grid.valid = true; } - if (type == NOT_VALID && (msg_dothrottle() || msg_grid.chars)) { + // After disabling msgsep the grid might not have been deallocated yet, + // hence we also need to check msg_grid.chars + if (type == NOT_VALID && (msg_use_grid() || msg_grid.chars)) { grid_fill(&default_grid, Rows-p_ch, Rows, 0, Columns, ' ', ' ', 0); } @@ -6250,7 +6252,7 @@ void screenclear(void) msg_scrolled = 0; // can't scroll back msg_didany = false; msg_didout = false; - if (HL_ATTR(HLF_MSG) > 0 && msg_dothrottle() && msg_grid.chars) { + if (HL_ATTR(HLF_MSG) > 0 && msg_use_grid() && msg_grid.chars) { grid_invalidate(&msg_grid); msg_grid_validate(); msg_grid_invalid = false; |