# HG changeset patch # User Christian Brabandt # Date 1715193005 -7200 # Node ID d8629e3fb51ec671d59b598bb666aca1341dcf51 # Parent b656220c18017e7a6eee95f8c4a791ff3351cbb7 patch 9.1.0397: Wrong display with 'smoothscroll' when changing quickfix list Commit: https://github.com/vim/vim/commit/c7a8eb5ff2ddd919e6f39faec93d81c52874695a Author: zeertzjq Date: Wed May 8 20:22:40 2024 +0200 patch 9.1.0397: Wrong display with 'smoothscroll' when changing quickfix list Problem: Wrong display with 'smoothscroll' when changing quickfix list. Solution: Reset w_skipcol when replacing quickfix list (zeertzjq). closes: #14730 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt diff --git a/src/move.c b/src/move.c --- a/src/move.c +++ b/src/move.c @@ -319,6 +319,7 @@ update_topline(void) redraw_later(UPD_NOT_VALID); curwin->w_topline = 1; curwin->w_botline = 2; + curwin->w_skipcol = 0; curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; curwin->w_scbind_pos = 1; } diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4867,6 +4867,9 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *bu if (old_last == NULL) { + win_T *wp; + tabpage_T *tp; + if (buf != curbuf) { internal_error("qf_fill_buffer()"); @@ -4883,6 +4886,10 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *bu while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) (void)ml_delete((linenr_T)1); + FOR_ALL_TAB_WINDOWS(tp, wp) + if (wp->w_buffer == curbuf) + wp->w_skipcol = 0; + // Remove all undo information u_clearallandblockfree(curbuf); } diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump @@ -0,0 +1,20 @@ +> +0&#ffffff0@59 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|[+3#0000000&|N|o| |N|a|m|e|]| @50 +|<+0#4040ff13&@2| +0#af5f00255&|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29 +| +0#af5f00255&|1|0| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| +| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29 +| +0#af5f00255&|1@1| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| +| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29 +|[+1&&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44 +| +0&&@59 diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump @@ -0,0 +1,20 @@ +> +0&#ffffff0@59 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|[+3#0000000&|N|o| |N|a|m|e|]| @50 +| +0#af5f00255&@1|1| | +0#0000000&@55 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|[+1#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44 +|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|[|]|,| |'|r|'|)| @35 diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump @@ -0,0 +1,20 @@ +> +0&#ffffff0@59 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|[+3#0000000&|N|o| |N|a|m|e|]| @50 +| +0#af5f00255&@1|1| ||+0#0000000#ffff4012@1| |f|o@1| @49 +| +0#af5f00255#ffffff0@1|2| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| +| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29 +| +0#af5f00255&@1|3| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| +| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29 +|[+1&&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44 +|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|,| |'|r|'|)| @34 diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump @@ -0,0 +1,20 @@ +> +0&#ffffff0@59 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|[+3#0000000&|N|o| |N|a|m|e|]| @50 +| +0#af5f00255&@1|1| ||+0#0000000#ffff4012@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| +| +0#af5f00255#ffffff0@3|2+0#0000000#ffff4012|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| |3|0| |3|1| |3|2| |3@1| |3|4| |3|5| |3|6| |3|7| |3|8| |3|9 +| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|4|0| |4|1| |4|2| |4|3| |4@1| |4|5| |4|6| |4|7| |4|8| |4|9| |5|0| |5|1| |5|2| |5|3| |5|4| |5@1| |5|6| |5|7| |5 +| +0#af5f00255#ffffff0@3|8+0#0000000#ffff4012| |5|9| |6|0| |6|1| |6|2| |6|3| |6|4| |6|5| |6@1| |6|7| |6|8| |6|9| |7|0| |7|1| |7|2| |7|3| |7|4| |7|5| |7|6| +| +0#af5f00255#ffffff0@3|7+0#0000000#ffff4012@1| |7|8| |7|9| |8|0| |8|1| |8|2| |8|3| |8|4| |8|5| |8|6| |8|7| |8@1| |8|9| |9|0| |9|1| |9|2| |9|3| |9|4| |9|5 +|[+1&#ffffff0|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44 +|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|1|,| |'|r|'|)| @33 diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump @@ -0,0 +1,20 @@ +> +0&#ffffff0@59 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +|[+3#0000000&|N|o| |N|a|m|e|]| @50 +|<+0#4040ff13&@2| +0#af5f00255&| +0#0000000#ffff4012|9|3|7| |9|3|8| |9|3|9| |9|4|0| |9|4|1| |9|4|2| |9|4|3| |9|4@1| |9|4|5| |9|4|6| |9|4|7| |9|4|8| |9|4|9| |9|5|0 +| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|5|1| |9|5|2| |9|5|3| |9|5|4| |9|5@1| |9|5|6| |9|5|7| |9|5|8| |9|5|9| |9|6|0| |9|6|1| |9|6|2| |9|6|3| |9|6|4 +| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|6|5| |9|6@1| |9|6|7| |9|6|8| |9|6|9| |9|7|0| |9|7|1| |9|7|2| |9|7|3| |9|7|4| |9|7|5| |9|7|6| |9|7@1| |9|7|8 +| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|7|9| |9|8|0| |9|8|1| |9|8|2| |9|8|3| |9|8|4| |9|8|5| |9|8|6| |9|8|7| |9|8@1| |9|8|9| |9@1|0| |9@1|1| |9@1|2 +| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9@1|3| |9@1|4| |9@1|5| |9@1|6| |9@1|7| |9@1|8| |9@2| @27 +|[+1&#ffffff0|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44 +|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|1|,| |'|r|'|)| @33 diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim --- a/src/testdir/test_scroll_opt.vim +++ b/src/testdir/test_scroll_opt.vim @@ -961,6 +961,51 @@ func Test_smoothscroll_insert_bottom() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_in_qf_window() + CheckFeature quickfix + CheckScreendump + + let lines =<< trim END + set nocompatible display=lastline + copen 5 + setlocal number smoothscroll + let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10) + call setqflist(g:l, 'r') + normal! G + wincmd t + let g:l1 = [{'text': join(range(1000))}] + END + call writefile(lines, 'XSmoothScrollInQfWindow', 'D') + let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInQfWindow', #{rows: 20, cols: 60}) + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_1', {}) + + call term_sendkeys(buf, ":call setqflist([], 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_2', {}) + + call term_sendkeys(buf, ":call setqflist(g:l, 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_3', {}) + + call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_4', {}) + + call term_sendkeys(buf, "\b$\t") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_5', {}) + + call term_sendkeys(buf, ":call setqflist([], 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_2', {}) + + call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_4', {}) + + call term_sendkeys(buf, "\b$\t") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_5', {}) + + call term_sendkeys(buf, ":call setqflist(g:l, 'r')\") + call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_3', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_smoothscroll_in_zero_width_window() set cpo+=n number smoothscroll set winwidth=99999 winminwidth=0 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 397, +/**/ 396, /**/ 395,