diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-23 08:12:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-23 08:12:10 +0800 |
commit | a9c12d4c298813ed3aee36b2b4d5d0912c7201ea (patch) | |
tree | 3efd52839a53b826d2559125cd3f1ed86d738391 /src | |
parent | fd55c7df6f7eb61c65e93c6dd8beffaeed93d2ed (diff) | |
download | rneovim-a9c12d4c298813ed3aee36b2b4d5d0912c7201ea.tar.gz rneovim-a9c12d4c298813ed3aee36b2b4d5d0912c7201ea.tar.bz2 rneovim-a9c12d4c298813ed3aee36b2b4d5d0912c7201ea.zip |
vim-patch:9.1.1048: crash after scrolling and pasting in silent Ex mode (#32168)
Problem: Crash after scrolling and pasting in silent Ex mode.
(fizz-is-on-the-way)
Solution: Don't move cursor to line 0 when scrolling.
(zeertzjq)
closes: vim/vim#16506
https://github.com/vim/vim/commit/df098fedbc2c481e91ea7e6207dab90359a92cc3
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index d912858420..afd569ba7d 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -2490,7 +2490,10 @@ int pagescroll(Direction dir, int count, bool half) if (!nochange) { // Place cursor at top or bottom of window. validate_botline(curwin); - curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1); + linenr_T lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1); + // In silent Ex mode the value of w_botline - 1 may be 0, + // but cursor lnum needs to be at least 1. + curwin->w_cursor.lnum = MAX(lnum, 1); } } |