aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/state.c
diff options
context:
space:
mode:
authorfredizzimo <fsundvik@gmail.com>2024-10-03 12:31:17 +0300
committerGitHub <noreply@github.com>2024-10-03 02:31:17 -0700
commit7eba016c86818c5f6fa1542500b19d27bb7ab15c (patch)
treede8afaf3ed4f11f2d7d52a9a7c229ceb971ce823 /src/nvim/state.c
parentb9737891154750e16429e67c92f392d8f29bd820 (diff)
downloadrneovim-7eba016c86818c5f6fa1542500b19d27bb7ab15c.tar.gz
rneovim-7eba016c86818c5f6fa1542500b19d27bb7ab15c.tar.bz2
rneovim-7eba016c86818c5f6fa1542500b19d27bb7ab15c.zip
fix(ui): ensure screen update before waiting for input #30576
Ensure the screen is fully updated before blocking for input. This did not always happen before, for example when setting `cursorline scrolloff=9999`, which lead to jerky movement when using some GUI applications. Because of the duality of redraw_later, this can't be done in command-line or when waiting for "Press ENTER". In many of those cases the redraw is expected AFTER the key press, while normally it should update the screen immediately. So, those special cases are excluded.
Diffstat (limited to 'src/nvim/state.c')
-rw-r--r--src/nvim/state.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 1b08a08fba..908f724792 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -66,9 +66,11 @@ getkey:
// Event was made available after the last multiqueue_process_events call
key = K_EVENT;
} else {
- // Duplicate display updating logic in vgetorpeek()
- if (((State & MODE_INSERT) != 0 || p_lz) && (State & MODE_CMDLINE) == 0
- && must_redraw != 0 && !need_wait_return) {
+ // Ensure the screen is fully updated before blocking for input. Because of the duality of
+ // redraw_later, this can't be done in command-line or when waiting for "Press ENTER".
+ // In many of those cases the redraw is expected AFTER the key press, while normally it should
+ // update the screen immediately.
+ if (must_redraw != 0 && !need_wait_return && (State & MODE_CMDLINE) == 0) {
update_screen();
setcursor(); // put cursor back where it belongs
}