summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-03 22:08:33 +0100
committerBram Moolenaar <Bram@vim.org>2023-06-03 22:08:33 +0100
commit3c802277604a6b21110e41bedfe4c937ba7c2b7d (patch)
tree507364a3f95394485aeb04422539333c5da87950
parentecb87dd7d3f7b9291092a7dd8fae1e59b9903252 (diff)
patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'v9.0.1603
Problem: Display wrong when scrolling multiple lines with 'smoothscroll' set. Solution: Redraw when w_skipcol changed. (closes #12477, closes #12468)
-rw-r--r--src/move.c6
-rw-r--r--src/testdir/dumps/Test_smooth_multi_skipcol_1.dump10
-rw-r--r--src/testdir/dumps/Test_smooth_multi_skipcol_2.dump10
-rw-r--r--src/testdir/test_scroll_opt.vim24
-rw-r--r--src/version.c2
5 files changed, 49 insertions, 3 deletions
diff --git a/src/move.c b/src/move.c
index ff2f494017..54f5648c21 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1785,6 +1785,7 @@ scrollup(
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)
size = linetabsize(curwin, curwin->w_topline);
@@ -1847,8 +1848,9 @@ scrollup(
}
}
- if (curwin->w_topline == prev_topline)
- // need to redraw even though w_topline didn't change
+ if (curwin->w_topline == prev_topline
+ || curwin->w_skipcol != prev_skipcol)
+ // need to redraw because wl_size of the 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
new file mode 100644
index 0000000000..80f563b715
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_multi_skipcol_1.dump
@@ -0,0 +1,10 @@
+> +8&#ffffff0@39
+| +0&&@39
+|a@39
+@10| @29
+@40
+@40
+@40
+@40
+|b@2| @36
+@22|1|,|0|-|1| @8|T|o|p|
diff --git a/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump b/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump
new file mode 100644
index 0000000000..9ef4aaf789
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_multi_skipcol_2.dump
@@ -0,0 +1,10 @@
+|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
+| +0&&@39
+@40
+@40
+@40
+|b@2| @36
+|c@2| @36
+|~+0#4040ff13&| @38
+|~| @38
+| +0#0000000&@21|3|,|5|0| @9|B|o|t|
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 7a95e6fecf..3806486bf6 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -777,7 +777,7 @@ func Test_smoothscroll_incsearch()
call setline(14, 'bbbb')
END
call writefile(lines, 'XSmoothIncsearch', 'D')
- let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols:40})
+ let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols: 40})
call term_sendkeys(buf, "/b")
call VerifyScreenDump(buf, 'Test_smooth_incsearch_1', {})
@@ -792,4 +792,26 @@ func Test_smoothscroll_incsearch()
call StopVimInTerminal(buf)
endfunc
+" Test scrolling multiple lines and stopping at non-zero skipcol.
+func Test_smoothscroll_multi_skipcol()
+ CheckScreendump
+
+ let lines =<< trim END
+ setlocal cursorline scrolloff=0 smoothscroll
+ call setline(1, repeat([''], 9))
+ call setline(3, repeat('a', 50))
+ call setline(8, 'bbb')
+ call setline(9, 'ccc')
+ redraw
+ END
+ call writefile(lines, 'XSmoothMultiSkipcol', 'D')
+ let buf = RunVimInTerminal('-S XSmoothMultiSkipcol', #{rows: 10, cols: 40})
+ call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_1', {})
+
+ call term_sendkeys(buf, "3\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index a724b7ccfa..311892c1ba 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 */
/**/
+ 1603,
+/**/
1602,
/**/
1601,