diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-10 20:27:54 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-10 20:34:34 -0400 |
commit | e1fa242a6c3a5914d31038b429338bb4f1c4ed76 (patch) | |
tree | 37312384632fed04aabe4aa33dcf84bbaf3b8e05 /src/nvim/move.c | |
parent | d4e6a75a0684e5cc827d0d905a67b4d0aa10b57e (diff) | |
download | rneovim-e1fa242a6c3a5914d31038b429338bb4f1c4ed76.tar.gz rneovim-e1fa242a6c3a5914d31038b429338bb4f1c4ed76.tar.bz2 rneovim-e1fa242a6c3a5914d31038b429338bb4f1c4ed76.zip |
vim-patch:8.1.0174: after paging up and down fold line is wrong
Problem: After paging up and down fold line is wrong.
Solution: Correct the computation of w_topline and w_botline. (Hirohito
Higashi)
https://github.com/vim/vim/commit/907dad72ef9d29422352fb74ba156e7085a3fc71
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r-- | src/nvim/move.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 41859a489f..4261a52054 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1884,16 +1884,18 @@ int onepage(int dir, long count) } curwin->w_valid &= ~(VALID_WCOL|VALID_WROW|VALID_VIRTCOL); - /* - * Avoid the screen jumping up and down when 'scrolloff' is non-zero. - * But make sure we scroll at least one line (happens with mix of long - * wrapping lines and non-wrapping line). - */ - if (retval == OK && dir == FORWARD && check_top_offset()) { - scroll_cursor_top(1, false); - if (curwin->w_topline <= old_topline - && old_topline < curbuf->b_ml.ml_line_count) { - curwin->w_topline = old_topline + 1; + if (retval == OK && dir == FORWARD) { + // Avoid the screen jumping up and down when 'scrolloff' is non-zero. + // But make sure we scroll at least one line (happens with mix of long + // wrapping lines and non-wrapping line). + if (check_top_offset()) { + scroll_cursor_top(1, false); + if (curwin->w_topline <= old_topline + && old_topline < curbuf->b_ml.ml_line_count) { + curwin->w_topline = old_topline + 1; + (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); + } + } else if (curwin->w_botline > curbuf->b_ml.ml_line_count) { (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); } } |