aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-10-05 21:50:12 +0200
committerGitHub <noreply@github.com>2022-10-05 21:50:12 +0200
commit6ae4a6e0711035a8a0801dd6fdb545e020bccd70 (patch)
tree0e76ac339ab041a087a623979e8218ec9223d8f1
parentede85dda2ee23820481d38d0def2d2c83da4e43e (diff)
parent7746f641b89d1d80b2121980f83ae1f322c30e89 (diff)
downloadrneovim-6ae4a6e0711035a8a0801dd6fdb545e020bccd70.tar.gz
rneovim-6ae4a6e0711035a8a0801dd6fdb545e020bccd70.tar.bz2
rneovim-6ae4a6e0711035a8a0801dd6fdb545e020bccd70.zip
Merge pull request #20374 from bfredl/notype
screen: refactor old curwin-heavy logic and graduate "msgsep" feature
-rw-r--r--runtime/doc/options.txt7
-rw-r--r--runtime/doc/syntax.txt2
-rw-r--r--runtime/doc/ui.txt10
-rw-r--r--runtime/doc/vim_diff.txt10
-rw-r--r--src/nvim/autocmd.c2
-rw-r--r--src/nvim/cmdexpand.c2
-rw-r--r--src/nvim/drawscreen.c281
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/ex_cmds.c3
-rw-r--r--src/nvim/ex_docmd.c15
-rw-r--r--src/nvim/ex_getln.c16
-rw-r--r--src/nvim/fileio.c7
-rw-r--r--src/nvim/generators/gen_options.lua1
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/insexpand.c10
-rw-r--r--src/nvim/main.c38
-rw-r--r--src/nvim/message.c74
-rw-r--r--src/nvim/move.c10
-rw-r--r--src/nvim/normal.c8
-rw-r--r--src/nvim/ops.c8
-rw-r--r--src/nvim/option.c16
-rw-r--r--src/nvim/option_defs.h2
-rw-r--r--src/nvim/options.lua15
-rw-r--r--src/nvim/popupmenu.c4
-rw-r--r--src/nvim/quickfix.c5
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/state.c2
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/ui_compositor.c2
-rw-r--r--src/nvim/version.c1
-rw-r--r--src/nvim/window.c11
-rw-r--r--test/functional/core/fileio_spec.lua2
-rw-r--r--test/functional/legacy/cmdline_spec.lua77
-rw-r--r--test/functional/ui/cmdline_spec.lua66
-rw-r--r--test/functional/ui/embed_spec.lua14
-rw-r--r--test/functional/ui/highlight_spec.lua11
-rw-r--r--test/functional/ui/messages_spec.lua22
-rw-r--r--test/functional/ui/screen_basic_spec.lua61
-rw-r--r--test/functional/ui/wildmode_spec.lua42
39 files changed, 232 insertions, 635 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 15fc551dd9..065fe1af70 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2128,7 +2128,7 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons.
*'display'* *'dy'*
-'display' 'dy' string (default "lastline,msgsep")
+'display' 'dy' string (default "lastline")
global
Change the way text is displayed. This is a comma-separated list of
flags:
@@ -2140,10 +2140,7 @@ A jump table for the options with a short description can be found at |Q_op|.
column of the last screen line. Overrules "lastline".
uhex Show unprintable characters hexadecimal as <xx>
instead of using ^C and ~C.
- msgsep When showing messages longer than 'cmdheight', only
- scroll the message lines, not the entire screen. The
- separator line is decorated by |hl-MsgSeparator| and
- the "msgsep" flag of 'fillchars'.
+ msgsep Obsolete flag. Allowed but takes no effect. |msgsep|
When neither "lastline" nor "truncate" is included, a last line that
doesn't fit is replaced with "@" lines.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 8ebe0f3569..74778addc7 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -5187,7 +5187,7 @@ ModeMsg 'showmode' message (e.g., "-- INSERT --").
*hl-MsgArea*
MsgArea Area for messages and cmdline.
*hl-MsgSeparator*
-MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'.
+MsgSeparator Separator for scrolled messages |msgsep|.
*hl-MoreMsg*
MoreMsg |more-prompt|
*hl-NonText*
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 7ce6cd251f..5685979c82 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -608,12 +608,12 @@ tabs.
Close the window.
["msg_set_pos", grid, row, scrolled, sep_char] ~
- Display messages on `grid`. The grid will be displayed at `row` on the
- default grid (grid=1), covering the full column width. `scrolled`
+ Display messages on `grid`. The grid will be displayed at `row` on
+ the default grid (grid=1), covering the full column width. `scrolled`
indicates whether the message area has been scrolled to cover other
- grids. It can be useful to draw a separator then ('display' msgsep
- flag). The Builtin TUI draws a full line filled with `sep_char` and
- |hl-MsgSeparator| highlight.
+ grids. It can be useful to draw a separator then |msgsep|. The Builtin
+ TUI draws a full line filled with `sep_char` ('fillchars' msgsep
+ field) and |hl-MsgSeparator| highlight.
When |ui-messages| is active, no message grid is used, and this event
will not be sent.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 672d064478..7c1658df76 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -38,7 +38,7 @@ centralized reference of the differences.
- 'complete' excludes "i"
- 'cscopeverbose' is enabled
- 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created
-- 'display' defaults to "lastline,msgsep"
+- 'display' defaults to "lastline"
- 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding)
- 'fillchars' defaults (in effect) to "vert:│,fold:·,sep:│"
- 'formatoptions' defaults to "tcqj"
@@ -256,9 +256,8 @@ Normal commands:
Options:
'cpoptions' flags: |cpo-_|
- 'display' flags: "msgsep" minimizes scrolling when showing messages
'guicursor' works in the terminal
- 'fillchars' flags: "msgsep" (see 'display'), "horiz", "horizup",
+ 'fillchars' flags: "msgsep", "horiz", "horizup",
"horizdown", "vertleft", "vertright", "verthoriz"
'foldcolumn' supports up to 9 dynamic/fixed columns
'inccommand' shows interactive results for |:substitute|-like commands
@@ -479,6 +478,11 @@ TUI:
UI/Display:
|Visual| selection highlights the character at cursor. |visual-use|
+ messages: When showing messages longer than 'cmdheight', only
+ scroll the message lines, not the entire screen. The
+ separator line is decorated by |hl-MsgSeparator| and
+ the "msgsep" flag of 'fillchars'. *msgsep*
+
Vimscript compatibility:
`count` does not alias to |v:count|
`errmsg` does not alias to |v:errmsg|
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 439704d120..81d495ee27 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -2720,7 +2720,7 @@ static void do_autocmd_focusgained(bool gained)
redrawcmdline();
} else if ((State & MODE_NORMAL) || (State & MODE_INSERT)) {
if (must_redraw != 0) {
- update_screen(0);
+ update_screen();
}
setcursor();
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 65b07cc17b..a29d022606 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -2810,7 +2810,7 @@ void wildmenu_cleanup(CmdlineInfo *cclp)
p_ls = save_p_ls;
p_wmh = save_p_wmh;
last_status(false);
- update_screen(UPD_VALID); // redraw the screen NOW
+ update_screen(); // redraw the screen NOW
redrawcmd();
save_p_ls = -1;
wild_menu_showing = 0;
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 8c18bf75e5..15a7294496 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -97,7 +97,7 @@ typedef enum {
static bool redraw_popupmenu = false;
static bool msg_grid_invalid = false;
-static bool resizing = false;
+static bool resizing_autocmd = false;
static char *provider_err = NULL;
@@ -115,7 +115,7 @@ void conceal_check_cursor_line(void)
}
}
-/// Resize the screen to Rows and Columns.
+/// Resize default_grid to Rows and Columns.
///
/// Allocate default_grid.chars[] and other grid arrays.
///
@@ -125,19 +125,18 @@ void conceal_check_cursor_line(void)
/// default_grid.Columns to access items in default_grid.chars[]. Use Rows
/// and Columns for positioning text etc. where the final size of the screen is
/// needed.
-void screenalloc(void)
+bool default_grid_alloc(void)
{
+ static bool resizing = false;
+
// It's possible that we produce an out-of-memory message below, which
// will cause this function to be called again. To break the loop, just
// return here.
if (resizing) {
- return;
+ return false;
}
resizing = true;
- int retry_count = 0;
-
-retry:
// Allocation of the screen buffers is done only when the size changes and
// when Rows and Columns have been set and we have started doing full
// screen stuff.
@@ -148,24 +147,9 @@ retry:
|| Columns == 0
|| (!full_screen && default_grid.chars == NULL)) {
resizing = false;
- return;
- }
-
- // Note that the window sizes are updated before reallocating the arrays,
- // thus we must not redraw here!
- RedrawingDisabled++;
-
- // win_new_screensize will recompute floats position, but tell the
- // compositor to not redraw them yet
- ui_comp_set_screen_valid(false);
- if (msg_grid.chars) {
- msg_grid_invalid = true;
+ return false;
}
- win_new_screensize(); // fit the windows in the new sized screen
-
- comp_col(); // recompute columns for shown command and ruler
-
// We're changing the size of the screen.
// - Allocate new arrays for default_grid
// - Move lines from the old arrays into the new arrays, clear extra
@@ -193,26 +177,13 @@ retry:
default_grid.col_offset = 0;
default_grid.handle = DEFAULT_GRID_HANDLE;
- must_redraw = UPD_CLEAR; // need to clear the screen later
-
- RedrawingDisabled--;
-
- // Do not apply autocommands more than 3 times to avoid an endless loop
- // in case applying autocommands always changes Rows or Columns.
- if (starting == 0 && ++retry_count <= 3) {
- apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, false, curbuf);
- // In rare cases, autocommands may have altered Rows or Columns,
- // jump back to check if we need to allocate the screen again.
- goto retry;
- }
-
resizing = false;
+ return true;
}
void screenclear(void)
{
check_for_delay(false);
- screenalloc(); // allocate screen buffers if size changed
int i;
@@ -281,13 +252,6 @@ void screen_resize(int width, int height)
return;
}
- // curwin->w_buffer can be NULL when we are closing a window and the
- // buffer has already been closed and removing a scrollbar causes a resize
- // event. Don't resize then, it will happen after entering another buffer.
- if (curwin->w_buffer == NULL) {
- return;
- }
-
resizing_screen = true;
Rows = height;
@@ -301,16 +265,54 @@ void screen_resize(int width, int height)
width = Columns;
p_lines = Rows;
p_columns = Columns;
- ui_call_grid_resize(1, width, height);
- /// The window layout used to be adjusted here, but it now happens in
- /// screenalloc() (also invoked from screenclear()). That is because the
- /// recursize "resizing_screen" check above may skip this, but not screenalloc().
+ // was invoked recursively from a VimResized autocmd, handled as a loop below
+ if (resizing_autocmd) {
+ return;
+ }
+
+ int retry_count = 0;
+ resizing_autocmd = true;
+
+ bool retry_resize = true;
+ while (retry_resize) {
+ retry_resize = default_grid_alloc();
- if (State != MODE_ASKMORE && State != MODE_EXTERNCMD && State != MODE_CONFIRM) {
- screenclear();
+ // Do not apply autocommands more than 3 times to avoid an endless loop
+ // in case applying autocommands always changes Rows or Columns.
+ if (++retry_count > 3) {
+ break;
+ }
+
+ if (retry_resize) {
+ // In rare cases, autocommands may have altered Rows or Columns,
+ // retry to check if we need to allocate the screen again.
+ apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, false, curbuf);
+ }
}
+ resizing_autocmd = false;
+
+ ui_call_grid_resize(1, width, height);
+
+ // win_new_screensize will recompute floats position, but tell the
+ // compositor to not redraw them yet
+ ui_comp_set_screen_valid(false);
+ if (msg_grid.chars) {
+ msg_grid_invalid = true;
+ }
+
+ // Note that the window sizes are updated before reallocating the arrays,
+ // thus we must not redraw here!
+ RedrawingDisabled++;
+
+ win_new_screensize(); // fit the windows in the new sized screen
+
+ comp_col(); // recompute columns for shown command and ruler
+
+ RedrawingDisabled--;
+ redraw_all_later(UPD_CLEAR);
+
if (starting != NO_SCREEN) {
maketitle();
@@ -320,14 +322,11 @@ void screen_resize(int width, int height)
// We only redraw when it's needed:
// - While at the more prompt or executing an external command, don't
// redraw, but position the cursor.
- // - While editing the command line, only redraw that.
+ // - While editing the command line, only redraw that. TODO: lies
// - in Ex mode, don't redraw anything.
// - Otherwise, redraw right now, and position the cursor.
- // Always need to call update_screen() or screenalloc(), to make
- // sure Rows/Columns and the size of the screen is correct!
if (State == MODE_ASKMORE || State == MODE_EXTERNCMD || State == MODE_CONFIRM
|| exmode_active) {
- screenalloc();
if (msg_grid.chars) {
msg_grid_validate();
}
@@ -341,7 +340,7 @@ void screen_resize(int width, int height)
}
if (State & MODE_CMDLINE) {
redraw_popupmenu = false;
- update_screen(UPD_NOT_VALID);
+ update_screen();
redrawcmdline();
if (pum_drawn()) {
cmdline_pum_display(false);
@@ -350,12 +349,12 @@ void screen_resize(int width, int height)
update_topline(curwin);
if (pum_drawn()) {
// TODO(bfredl): ins_compl_show_pum wants to redraw the screen first.
- // For now make sure the nested update_screen(0) won't redraw the
+ // For now make sure the nested update_screen() won't redraw the
// pum at the old position. Try to untangle this later.
redraw_popupmenu = false;
ins_compl_show_pum();
}
- update_screen(UPD_NOT_VALID);
+ update_screen();
if (redrawing()) {
setcursor();
}
@@ -370,9 +369,7 @@ void screen_resize(int width, int height)
///
/// Most code shouldn't call this directly, rather use redraw_later() and
/// and redraw_all_later() to mark parts of the screen as needing a redraw.
-///
-/// @param type set to a UPD_NOT_VALID to force redraw of entire screen
-int update_screen(int type)
+int update_screen(void)
{
static bool did_intro = false;
bool is_stl_global = global_stl_height() > 0;
@@ -380,7 +377,7 @@ int update_screen(int type)
// Don't do anything if the screen structures are (not yet) valid.
// A VimResized autocmd can invoke redrawing in the middle of a resize,
// which would bypass the checks in screen_resize for popupmenu etc.
- if (!default_grid.chars || resizing) {
+ if (resizing_autocmd || !default_grid.chars) {
return FAIL;
}
@@ -389,41 +386,25 @@ int update_screen(int type)
diff_redraw(true);
}
- // TODO(bfredl): completely get rid of using update_screen(UPD_XX_VALID)
- // to redraw curwin
- int curwin_type = MIN(type, UPD_NOT_VALID);
-
- if (must_redraw) {
- if (type < must_redraw) { // use maximal type
- type = must_redraw;
- }
-
- // must_redraw is reset here, so that when we run into some weird
- // reason to redraw while busy redrawing (e.g., asynchronous
- // scrolling), or update_topline() in win_update() will cause a
- // scroll, or a decoration provider requires a redraw, the screen
- // will be redrawn later or in win_update().
- must_redraw = 0;
- }
-
- // Need to update w_lines[].
- if (curwin->w_lines_valid == 0 && type < UPD_NOT_VALID) {
- type = UPD_NOT_VALID;
- }
-
// Postpone the redrawing when it's not needed and when being called
// recursively.
if (!redrawing() || updating_screen) {
- must_redraw = type;
- if (type > UPD_INVERTED_ALL) {
- curwin->w_lines_valid = 0; // don't use w_lines[].wl_size now
- }
return FAIL;
}
+
+ int type = must_redraw;
+
+ // must_redraw is reset here, so that when we run into some weird
+ // reason to redraw while busy redrawing (e.g., asynchronous
+ // scrolling), or update_topline() in win_update() will cause a
+ // scroll, or a decoration provider requires a redraw, the screen
+ // will be redrawn later or in win_update().
+ must_redraw = 0;
+
updating_screen = 1;
- display_tick++; // let syntax code know we're in a next round of
- // display updating
+ display_tick++; // let syntax code know we're in a next round of
+ // display updating
// Tricky: vim code can reset msg_scrolled behind our back, so need
// separate bookkeeping for now.
@@ -447,75 +428,41 @@ int update_screen(int type)
msg_grid.cols, false);
}
}
- if (msg_use_msgsep()) {
- msg_grid.throttled = false;
- bool was_invalidated = false;
+ msg_grid.throttled = false;
+ bool was_invalidated = false;
- // UPD_CLEAR is already handled
- if (type == UPD_NOT_VALID && !ui_has(kUIMultigrid) && msg_scrolled) {
- was_invalidated = ui_comp_set_screen_valid(false);
- for (int i = valid; i < Rows - p_ch; i++) {
- grid_clear_line(&default_grid, default_grid.line_offset[i],
- Columns, false);
+ // UPD_CLEAR is already handled
+ if (type == UPD_NOT_VALID && !ui_has(kUIMultigrid) && msg_scrolled) {
+ was_invalidated = ui_comp_set_screen_valid(false);
+ for (int i = valid; i < Rows - p_ch; i++) {
+ grid_clear_line(&default_grid, default_grid.line_offset[i],
+ Columns, false);
+ }
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ if (wp->w_floating) {
+ continue;
}
- FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (wp->w_floating) {
- continue;
- }
- if (W_ENDROW(wp) > valid) {
- // TODO(bfredl): too pessimistic. type could be UPD_NOT_VALID
- // only because windows that are above the separator.
- wp->w_redr_type = MAX(wp->w_redr_type, UPD_NOT_VALID);
- }
- if (!is_stl_global && W_ENDROW(wp) + wp->w_status_height > valid) {
- wp->w_redr_status = true;
- }
+ if (W_ENDROW(wp) > valid) {
+ // TODO(bfredl): too pessimistic. type could be UPD_NOT_VALID
+ // only because windows that are above the separator.
+ wp->w_redr_type = MAX(wp->w_redr_type, UPD_NOT_VALID);
}
- if (is_stl_global && Rows - p_ch - 1 > valid) {
- curwin->w_redr_status = true;
+ if (!is_stl_global && W_ENDROW(wp) + wp->w_status_height > valid) {
+ wp->w_redr_status = true;
}
}
- msg_grid_set_pos(Rows - (int)p_ch, false);
- msg_grid_invalid = false;
- if (was_invalidated) {
- // screen was only invalid for the msgarea part.
- // @TODO(bfredl): using the same "valid" flag
- // for both messages and floats moving is bit of a mess.
- ui_comp_set_screen_valid(true);
- }
- } else if (type != UPD_CLEAR) {
- if (msg_scrolled > Rows - 5) { // redrawing is faster
- type = UPD_NOT_VALID;
- curwin_type = UPD_NOT_VALID;
- } else {
- check_for_delay(false);
- grid_ins_lines(&default_grid, 0, msg_scrolled, Rows, 0, Columns);
- FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (wp->w_floating) {
- continue;
- }
- if (wp->w_winrow < msg_scrolled) {
- if (W_ENDROW(wp) > msg_scrolled
- && wp->w_redr_type < UPD_REDRAW_TOP
- && wp->w_lines_valid > 0
- && wp->w_topline == wp->w_lines[0].wl_lnum) {
- wp->w_upd_rows = msg_scrolled - wp->w_winrow;
- wp->w_redr_type = UPD_REDRAW_TOP;
- } else {
- wp->w_redr_type = UPD_NOT_VALID;
- if (wp->w_winrow + wp->w_winbar_height <= msg_scrolled) {
- wp->w_redr_status = true;
- }
- }
- }
- }
- if (is_stl_global && Rows - p_ch - 1 <= msg_scrolled) {
- curwin->w_redr_status = true;
- }
- redraw_cmdline = true;
- redraw_tabline = true;
+ if (is_stl_global && Rows - p_ch - 1 > valid) {
+ curwin->w_redr_status = true;
}
}
+ msg_grid_set_pos(Rows - (int)p_ch, false);
+ msg_grid_invalid = false;
+ if (was_invalidated) {
+ // screen was only invalid for the msgarea part.
+ // @TODO(bfredl): using the same "valid" flag
+ // for both messages and floats moving is bit of a mess.
+ ui_comp_set_screen_valid(true);
+ }
msg_scrolled = 0;
msg_scrolled_at_flush = 0;
need_wait_return = false;
@@ -535,7 +482,8 @@ int update_screen(int type)
}
if (type == UPD_CLEAR) { // first clear screen
- screenclear(); // will reset clear_cmdline
+ screenclear(); // will reset clear_cmdline
+ // and set UPD_NOT_VALID for each window
cmdline_screen_cleared(); // clear external cmdline state
type = UPD_NOT_VALID;
// must_redraw may be set indirectly, avoid another redraw later
@@ -545,9 +493,8 @@ int update_screen(int type)
default_grid.valid = true;
}
- // After disabling msgsep the grid might not have been deallocated yet,
- // hence we also need to check msg_grid.chars
- if (type == UPD_NOT_VALID && (msg_use_grid() || msg_grid.chars)) {
+ // might need to clear space on default_grid for the message area.
+ if (type == UPD_NOT_VALID && clear_cmdline && !ui_has(kUIMessages)) {
grid_fill(&default_grid, Rows - (int)p_ch, Rows, 0, Columns, ' ', ' ', 0);
}
@@ -576,28 +523,6 @@ int update_screen(int type)
curwin->w_redr_type = UPD_NOT_VALID;
}
- // Only start redrawing if there is really something to do.
- // TODO(bfredl): more curwin special casing to get rid of.
- // Change update_screen(UPD_INVERTED) to a wrapper function
- // perhaps?
- if (curwin_type == UPD_INVERTED) {
- update_curswant();
- }
- if (curwin->w_redr_type < curwin_type
- && !((curwin_type == UPD_VALID
- && curwin->w_lines[0].wl_valid
- && curwin->w_topfill == curwin->w_old_topfill
- && curwin->w_botfill == curwin->w_old_botfill
- && curwin->w_topline == curwin->w_lines[0].wl_lnum)
- || (curwin_type == UPD_INVERTED
- && VIsual_active
- && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum
- && curwin->w_old_visual_mode == VIsual_mode
- && (curwin->w_valid & VALID_VIRTCOL)
- && curwin->w_old_curswant == curwin->w_curswant))) {
- curwin->w_redr_type = curwin_type;
- }
-
// Redraw the tab pages line if needed.
if (redraw_tabline || type >= UPD_NOT_VALID) {
update_window_hl(curwin, type >= UPD_NOT_VALID);
@@ -2034,7 +1959,7 @@ win_update_start:
}
}
-/// Redraw a window later, with update_screen(type).
+/// Redraw a window later, with wp->w_redr_type >= type.
///
/// Set must_redraw only if not already set to a higher value.
/// e.g. if must_redraw is UPD_CLEAR, type UPD_NOT_VALID will do nothing.
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index a165078bdf..781e9e3553 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1286,7 +1286,7 @@ void ins_redraw(bool ready)
// a "(". The autocommand may also require a redraw, so it's done
// again below, unfortunately.
if (syntax_present(curwin) && must_redraw) {
- update_screen(0);
+ update_screen();
}
// Make sure curswant is correct, an autocommand may call
// getcurpos()
@@ -1348,7 +1348,7 @@ void ins_redraw(bool ready)
pum_check_clear();
if (must_redraw) {
- update_screen(0);
+ update_screen();
} else if (clear_cmdline || redraw_cmdline) {
showmode(); // clear cmdline and show mode
}
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 77feddbbf9..ea51cac163 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3876,7 +3876,8 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
update_topline(curwin);
validate_cursor();
- update_screen(UPD_SOME_VALID);
+ redraw_later(curwin, UPD_SOME_VALID);
+ update_screen();
highlight_match = false;
redraw_later(curwin, UPD_SOME_VALID);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 987fb439d7..5591b5f55d 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -254,7 +254,7 @@ void do_exmode(void)
RedrawingDisabled--;
no_wait_return--;
redraw_all_later(UPD_NOT_VALID);
- update_screen(UPD_NOT_VALID);
+ update_screen();
need_wait_return = false;
msg_scroll = save_msg_scroll;
}
@@ -6090,9 +6090,10 @@ static void ex_redraw(exarg_T *eap)
if (eap->forceit) {
redraw_all_later(UPD_NOT_VALID);
redraw_cmdline = true;
+ } else if (VIsual_active) {
+ redraw_curbuf_later(UPD_INVERTED);
}
- update_screen(eap->forceit ? UPD_NOT_VALID
- : VIsual_active ? UPD_INVERTED : 0);
+ update_screen();
if (need_maketitle) {
maketitle();
}
@@ -6123,16 +6124,16 @@ static void ex_redrawstatus(exarg_T *eap)
} else {
status_redraw_curbuf();
}
- if (msg_scrolled && !msg_use_msgsep() && (State & MODE_CMDLINE)) {
- return; // redraw later
- }
RedrawingDisabled = 0;
p_lz = false;
if (State & MODE_CMDLINE) {
redraw_statuslines();
} else {
- update_screen(VIsual_active ? UPD_INVERTED : 0);
+ if (VIsual_active) {
+ redraw_curbuf_later(UPD_INVERTED);
+ }
+ update_screen();
}
RedrawingDisabled = r;
p_lz = p;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 4b54b58ac1..6883dc5b14 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -501,7 +501,8 @@ static void may_do_incsearch_highlighting(int firstc, long count, incsearch_stat
curwin->w_redr_status = true;
}
- update_screen(UPD_SOME_VALID);
+ redraw_later(curwin, UPD_SOME_VALID);
+ update_screen();
highlight_match = false;
restore_last_search_pattern();
@@ -588,7 +589,7 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool
validate_cursor(); // needed for TAB
redraw_all_later(UPD_SOME_VALID);
if (call_update_screen) {
- update_screen(UPD_SOME_VALID);
+ update_screen();
}
}
}
@@ -774,7 +775,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
// Redraw the statusline in case it uses the current mode using the mode()
// function.
- if (!cmd_silent && (msg_scrolled == 0 || msg_use_msgsep())) {
+ if (!cmd_silent) {
bool found_one = false;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
@@ -1376,7 +1377,8 @