aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-03-28 10:20:45 +0100
committerLuuk van Baal <luukvbaal@gmail.com>2024-03-28 11:39:34 +0100
commit2f638c0ac6275bebacd12671481642fa43d7ba10 (patch)
tree670cc5d23f380742a3ffb979097ab2ca8d1b3b36 /src/nvim/normal.c
parent4147302f4be3fe8a5dae3f20a336477cb5f507a4 (diff)
downloadrneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.tar.gz
rneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.tar.bz2
rneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.zip
vim-patch:9.1.0215: Half-page scrolling does not support smooth-scrolling
Problem: Page-wise scrolling with Ctrl-D/Ctrl-U implements it's own logic to change the topline and cursor. More logic than necessary for scrolling with Ctrl-F/Ctrl-B was removed in patch 9.1.0211. Solution: Re-use the logic from Ctrl-E/Ctrl-Y/Ctrl-F/Ctrl-B while staying backward compatible as much as possible. Restore some of the logic that determined how many lines will be scrolled (Luuk van Baal) https://github.com/vim/vim/commit/5a2e3ec9ac72b6e644fea4ebba7e632498296e2f
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 12f0bb631e..bbba8069c7 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2258,7 +2258,7 @@ static void nv_page(cmdarg_T *cap)
goto_tabpage(cap->count0);
}
} else {
- onepage(cap->arg, cap->count1);
+ pagescroll(cap->arg, cap->count1, false);
}
}
@@ -6394,12 +6394,8 @@ static void nv_at(cmdarg_T *cap)
/// Handle the CTRL-U and CTRL-D commands.
static void nv_halfpage(cmdarg_T *cap)
{
- if ((cap->cmdchar == Ctrl_U && curwin->w_cursor.lnum == 1)
- || (cap->cmdchar == Ctrl_D
- && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)) {
- clearopbeep(cap->oap);
- } else if (!checkclearop(cap->oap)) {
- halfpage(cap->cmdchar == Ctrl_D, cap->count0);
+ if (!checkclearop(cap->oap)) {
+ pagescroll(cap->cmdchar == Ctrl_D, cap->count0, true);
}
}