summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-05 18:41:35 +0100
committerBram Moolenaar <Bram@vim.org>2023-06-05 18:41:35 +0100
commitd9a92dc70b20c76cef9ca186676583c92c14311c (patch)
treed42e0ec7f1d2886af0393fd25221e1655640c379
parentf7ca56f7193f8b383be43f1f6b3a6c6ca77b4233 (diff)
patch 9.0.1610: display is wrong when 'smoothscroll' is setv9.0.1610
Problem: Display is wrong when 'smoothscroll' is set and scrolling multiple lines. Solution: Redraw with UPD_NOT_VALID when "skipcol" is or was set. (closes #12490, closes #12468)
-rw-r--r--src/move.c8
-rw-r--r--src/testdir/dumps/Test_smooth_multi_skipcol_1.dump4
-rw-r--r--src/testdir/dumps/Test_smooth_multi_skipcol_2.dump4
-rw-r--r--src/testdir/dumps/Test_smooth_multi_skipcol_3.dump10
-rw-r--r--src/testdir/test_scroll_opt.vim10
-rw-r--r--src/version.c2
6 files changed, 26 insertions, 12 deletions
diff --git a/src/move.c b/src/move.c
index e021d71c59..4cd4d1c2bc 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1786,7 +1786,6 @@ scrollup(
int width1 = curwin->w_width - curwin_col_off();
int width2 = width1 + curwin_col_off2();
int size = 0;
- linenr_T prev_topline = curwin->w_topline;
colnr_T prev_skipcol = curwin->w_skipcol;
if (do_sms)
@@ -1850,10 +1849,9 @@ scrollup(
}
}
- // TODO: is comparing w_topline with prev_topline still needed?
- if (curwin->w_topline == prev_topline
- || curwin->w_skipcol != prev_skipcol)
- // need to redraw because wl_size of the topline may now be invalid
+ if (prev_skipcol > 0 || curwin->w_skipcol > 0)
+ // need to redraw more, because wl_size of the (new) topline may
+ // now be invalid
redraw_later(UPD_NOT_VALID);
}
else
diff --git a/src/testdir/dumps/Test_smooth_multi_skipcol_1.dump b/src/testdir/dumps/Test_smooth_multi_skipcol_1.dump
index 80f563b715..f642e9263a 100644
--- a/src/testdir/dumps/Test_smooth_multi_skipcol_1.dump
+++ b/src/testdir/dumps/Test_smooth_multi_skipcol_1.dump
@@ -2,8 +2,8 @@
| +0&&@39
|a@39
@10| @29
-@40
-@40
+|a@39
+@10| @29
@40
@40
|b@2| @36
diff --git a/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump b/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump
index 9ef4aaf789..7431351c78 100644
--- a/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump
+++ b/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump
@@ -1,6 +1,6 @@
|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
-| +0&&@39
-@40
+|a+0&&@39
+@10| @29
@40
@40
|b@2| @36
diff --git a/src/testdir/dumps/Test_smooth_multi_skipcol_3.dump b/src/testdir/dumps/Test_smooth_multi_skipcol_3.dump
new file mode 100644
index 0000000000..a79f3fe633
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_multi_skipcol_3.dump
@@ -0,0 +1,10 @@
+|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
+| +0&&@39
+@40
+|b@2| @36
+|c@2| @36
+|~+0#4040ff13&| @38
+|~| @38
+|~| @38
+|~| @38
+| +0#0000000&@21|4|,|5|0| @9|B|o|t|
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 3806486bf6..f8b4b4f09e 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -798,10 +798,11 @@ func Test_smoothscroll_multi_skipcol()
let lines =<< trim END
setlocal cursorline scrolloff=0 smoothscroll
- call setline(1, repeat([''], 9))
+ call setline(1, repeat([''], 8))
call setline(3, repeat('a', 50))
- call setline(8, 'bbb')
- call setline(9, 'ccc')
+ call setline(4, repeat('a', 50))
+ call setline(7, 'bbb')
+ call setline(8, 'ccc')
redraw
END
call writefile(lines, 'XSmoothMultiSkipcol', 'D')
@@ -811,6 +812,9 @@ func Test_smoothscroll_multi_skipcol()
call term_sendkeys(buf, "3\<C-E>")
call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {})
+ call term_sendkeys(buf, "2\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_3', {})
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 1288490670..a8f2104698 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1610,
+/**/
1609,
/**/
1608,