aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/move.c5
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua35
2 files changed, 34 insertions, 6 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index ead2b3b0d3..c9b7ba4ae0 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -248,7 +248,6 @@ void update_topline(win_T *wp)
}
linenr_T old_topline = wp->w_topline;
- colnr_T old_skipcol = wp->w_skipcol;
int old_topfill = wp->w_topfill;
// If the buffer is empty, always set topline to 1.
@@ -413,8 +412,8 @@ void update_topline(win_T *wp)
dollar_vcol = -1;
redraw_later(wp, UPD_VALID);
- // Only reset w_skipcol if it was not just set to make cursor visible.
- if (wp->w_skipcol == old_skipcol) {
+ // When 'smoothscroll' is not set, should reset w_skipcol.
+ if (!wp->w_p_sms) {
reset_skipcol(wp);
}
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 838ada4006..056262939b 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -422,12 +422,41 @@ describe('smoothscroll', function()
|
]])
feed('j')
- screen:expect_unchanged()
+ screen:expect([[
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ ^Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ @ |
+ |
+ ]])
-- moving cursor down - whole bottom line shows
feed('<C-E>j')
- screen:expect_unchanged()
+ screen:expect([[
+ <<<h some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ ^Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ |
+ ]])
feed('G')
- screen:expect_unchanged()
+ -- FIXME: different from vim onwards, this had in incorrect cursor position
+ -- in vim but we show an eob line.
+ screen:expect([[
+ <<<h some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ ^with some text with some text |
+ |
+ ]])
-- moving cursor up right after the >>> marker - no need to show whole line
feed('2gj3l2k')
screen:expect([[