From 5651c1ff27a1eb59d120637ba5cbd90f08a3f1d2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 4 Dec 2023 06:42:47 +0800 Subject: vim-patch:9.0.2145: wrong scrolling in insert mode with smoothscroll (#26375) Problem: Wrong scrolling in Insert mode with 'smoothscroll' at the bottom of the window. Solution: Don't use set_topline() when 'smoothscroll' is set. fixes: vim/vim#13612 closes: vim/vim#13613 https://github.com/vim/vim/commit/5b4d1fcbf06757bae32a894871b9a649c84eba7f --- src/nvim/drawscreen.c | 2 ++ src/nvim/edit.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index fd1589f0c5..85f62db774 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -2644,6 +2644,8 @@ int number_width(win_T *wp) /// e.g. if must_redraw is UPD_CLEAR, type UPD_NOT_VALID will do nothing. void redraw_later(win_T *wp, int type) { + // curwin may have been set to NULL when exiting + assert(wp != NULL || exiting); if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= UPD_NOT_VALID) { diff --git a/src/nvim/edit.c b/src/nvim/edit.c index dd7cd9a573..ba2885a162 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -444,8 +444,11 @@ static int insert_check(VimState *state) // is detected when the cursor column is smaller after inserting something. // Don't do this when the topline changed already, it has already been // adjusted (by insertchar() calling open_line())). + // Also don't do this when 'smoothscroll' is set, as the window should then + // be scrolled by screen lines. if (curbuf->b_mod_set && curwin->w_p_wrap + && !curwin->w_p_sms && !s->did_backspace && curwin->w_topline == s->old_topline && curwin->w_topfill == s->old_topfill) { -- cgit