aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/plines.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-04-27 03:36:31 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-05-02 13:11:47 +0200
commit88d13d2778a4fab3fdcc2bf4c1adf631b38ea3ce (patch)
tree6a412cb67c8da4425d325a1ca704976f8d273b15 /src/nvim/plines.c
parent0588329c8569553e3232e72889a28496a30aa54b (diff)
downloadrneovim-88d13d2778a4fab3fdcc2bf4c1adf631b38ea3ce.tar.gz
rneovim-88d13d2778a4fab3fdcc2bf4c1adf631b38ea3ce.tar.bz2
rneovim-88d13d2778a4fab3fdcc2bf4c1adf631b38ea3ce.zip
vim-patch:9.0.0807: with 'smoothscroll' typing "0" may not go to the first column
Problem: With 'smoothscroll' typing "0" may not go to the first column. Solution: Recompute w_cline_height when needed. Do not scroll up when it would move the cursor. https://github.com/vim/vim/commit/d5337efece7c68e9b4ce864532ea49b02453b674 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/plines.c')
-rw-r--r--src/nvim/plines.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index 3c8ee7d66d..3e69e547cb 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -189,10 +189,11 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
/// @param[out] nextp if not NULL, the line after a fold
/// @param[out] foldedp if not NULL, whether lnum is on a fold
/// @param[in] cache whether to use the window's cache for folds
+/// @param[in] winheight when true limit to window height
///
/// @return the total number of screen lines
int plines_win_full(win_T *wp, linenr_T lnum, linenr_T *const nextp, bool *const foldedp,
- const bool cache)
+ const bool cache, const bool winheight)
{
bool folded = hasFoldingWin(wp, lnum, NULL, nextp, cache, NULL);
if (foldedp) {
@@ -201,9 +202,9 @@ int plines_win_full(win_T *wp, linenr_T lnum, linenr_T *const nextp, bool *const
if (folded) {
return 1;
} else if (lnum == wp->w_topline) {
- return plines_win_nofill(wp, lnum, true) + wp->w_topfill;
+ return plines_win_nofill(wp, lnum, winheight) + wp->w_topfill;
}
- return plines_win(wp, lnum, true);
+ return plines_win(wp, lnum, winheight);
}
int plines_m_win(win_T *wp, linenr_T first, linenr_T last)
@@ -212,7 +213,7 @@ int plines_m_win(win_T *wp, linenr_T first, linenr_T last)
while (first <= last) {
linenr_T next = first;
- count += plines_win_full(wp, first, &next, NULL, false);
+ count += plines_win_full(wp, first, &next, NULL, false, true);
first = next + 1;
}
return count;