To: vim_dev@googlegroups.com Subject: Patch 9.0.1568 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1568 Problem: With 'smoothscroll' cursor may move below botline. Solution: Call redraw_later() if needed, Compute cursor row with adjusted condition. (Luuk van Baal, closes #12415) Files: src/move.c, src/testdir/test_scroll_opt.vim, src/testdir/dumps/Test_smooth_incsearch_1.dump, src/testdir/dumps/Test_smooth_incsearch_2.dump, src/testdir/dumps/Test_smooth_incsearch_3.dump, src/testdir/dumps/Test_smooth_incsearch_4.dump, src/testdir/dumps/Test_smooth_wrap_2.dump, src/testdir/dumps/Test_smooth_wrap_4.dump *** ../vim-9.0.1567/src/move.c 2023-05-18 13:26:50.038801412 +0100 --- src/move.c 2023-05-19 13:58:33.753673419 +0100 *************** *** 519,524 **** --- 519,526 ---- // When 'smoothscroll' is not set, should reset w_skipcol. if (!curwin->w_p_sms) reset_skipcol(); + else if (curwin->w_skipcol != 0) + redraw_later(UPD_SOME_VALID); // May need to set w_skipcol when cursor in w_topline. if (curwin->w_cursor.lnum == curwin->w_topline) *************** *** 892,901 **** --i; // hold at inserted lines } if (valid #ifdef FEAT_DIFF ! && (lnum != wp->w_topline || !wp->w_p_diff) #endif ! ) { #ifdef FEAT_FOLDING lnum = wp->w_lines[i].wl_lastlnum + 1; --- 894,904 ---- --i; // hold at inserted lines } if (valid + && (lnum != wp->w_topline || (wp->w_skipcol == 0 #ifdef FEAT_DIFF ! && !wp->w_p_diff #endif ! ))) { #ifdef FEAT_FOLDING lnum = wp->w_lines[i].wl_lastlnum + 1; *** ../vim-9.0.1567/src/testdir/test_scroll_opt.vim 2023-05-15 18:17:20.282336344 +0100 --- src/testdir/test_scroll_opt.vim 2023-05-19 13:58:33.753673419 +0100 *************** *** 257,267 **** call term_sendkeys(buf, "G") call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) ! " moving cursor up right after the >>> marker - no need to show whole line call term_sendkeys(buf, "2gj3l2k") call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {}) ! " moving cursor up where the >>> marker is - whole top line shows call term_sendkeys(buf, "2j02k") call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {}) --- 257,270 ---- call term_sendkeys(buf, "G") call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) ! call term_sendkeys(buf, "4\G") ! call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) ! ! " moving cursor up right after the <<< marker - no need to show whole line call term_sendkeys(buf, "2gj3l2k") call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {}) ! " moving cursor up where the <<< marker is - whole top line shows call term_sendkeys(buf, "2j02k") call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {}) *************** *** 704,708 **** --- 707,737 ---- call StopVimInTerminal(buf) endfunc + + " skipcol should not reset when doing incremental search on the same word + func Test_smoothscroll_incsearch() + CheckScreendump + + let lines =<< trim END + set smoothscroll number scrolloff=0 incsearch + call setline(1, repeat([''], 20)) + call setline(11, repeat('a', 100)) + call setline(14, 'bbbb') + END + call writefile(lines, 'XSmoothIncsearch', 'D') + let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols:40}) + + call term_sendkeys(buf, "/b") + call VerifyScreenDump(buf, 'Test_smooth_incsearch_1', {}) + call term_sendkeys(buf, "b") + call VerifyScreenDump(buf, 'Test_smooth_incsearch_2', {}) + call term_sendkeys(buf, "b") + call VerifyScreenDump(buf, 'Test_smooth_incsearch_3', {}) + call term_sendkeys(buf, "b") + call VerifyScreenDump(buf, 'Test_smooth_incsearch_4', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) + endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_incsearch_1.dump 2023-05-19 14:04:03.253880139 +0100 --- src/testdir/dumps/Test_smooth_incsearch_1.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 0 **** --- 1,8 ---- + |<+0#4040ff13#ffffff0@2| +0#af5f00255&|a+0#0000000&@27| @7 + | +0#af5f00255&|1|2| | +0#0000000&@35 + | +0#af5f00255&|1|3| | +0#0000000&@35 + | +0#af5f00255&|1|4| |b+1#0000000&|b+0&&@2| @31 + | +0#af5f00255&|1|5| | +0#0000000&@35 + | +0#af5f00255&|1|6| | +0#0000000&@35 + | +0#af5f00255&|1|7| | +0#0000000&@35 + |/|b> @37 *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_incsearch_2.dump 2023-05-19 14:04:03.257880141 +0100 --- src/testdir/dumps/Test_smooth_incsearch_2.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 0 **** --- 1,8 ---- + |<+0#4040ff13#ffffff0@2| +0#af5f00255&|a+0#0000000&@27| @7 + | +0#af5f00255&|1|2| | +0#0000000&@35 + | +0#af5f00255&|1|3| | +0#0000000&@35 + | +0#af5f00255&|1|4| |b+1#0000000&@1|b+0&&@1| @31 + | +0#af5f00255&|1|5| | +0#0000000&@35 + | +0#af5f00255&|1|6| | +0#0000000&@35 + | +0#af5f00255&|1|7| | +0#0000000&@35 + |/|b@1> @36 *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_incsearch_3.dump 2023-05-19 14:04:03.265880142 +0100 --- src/testdir/dumps/Test_smooth_incsearch_3.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 0 **** --- 1,8 ---- + |<+0#4040ff13#ffffff0@2| +0#af5f00255&|a+0#0000000&@27| @7 + | +0#af5f00255&|1|2| | +0#0000000&@35 + | +0#af5f00255&|1|3| | +0#0000000&@35 + | +0#af5f00255&|1|4| |b+1#0000000&@2|b+0&&| @31 + | +0#af5f00255&|1|5| | +0#0000000&@35 + | +0#af5f00255&|1|6| | +0#0000000&@35 + | +0#af5f00255&|1|7| | +0#0000000&@35 + |/|b@2> @35 *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_incsearch_4.dump 2023-05-19 14:04:03.269880146 +0100 --- src/testdir/dumps/Test_smooth_incsearch_4.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 0 **** --- 1,8 ---- + |<+0#4040ff13#ffffff0@2| +0#af5f00255&|a+0#0000000&@27| @7 + | +0#af5f00255&|1|2| | +0#0000000&@35 + | +0#af5f00255&|1|3| | +0#0000000&@35 + | +0#af5f00255&|1|4| |b+1#0000000&@3| +0&&@31 + | +0#af5f00255&|1|5| | +0#0000000&@35 + | +0#af5f00255&|1|6| | +0#0000000&@35 + | +0#af5f00255&|1|7| | +0#0000000&@35 + |/|b@3> @34 *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_wrap_2.dump 2023-05-18 13:26:50.038801412 +0100 --- src/testdir/dumps/Test_smooth_wrap_2.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 1,8 **** ! |L+0&#ffffff0|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 ! |@+0#4040ff13&@2| @36 ! | +0#0000000&@21|4|,|1| @10|4|0|%| --- 1,8 ---- ! |<+0#4040ff13#ffffff0@2|h+0#0000000&| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 ! |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 ! @22|4|,|1| @10|2|5|%| *** ../vim-9.0.1567/src/testdir/dumps/Test_smooth_wrap_4.dump 2023-05-18 13:26:50.038801412 +0100 --- src/testdir/dumps/Test_smooth_wrap_4.dump 2023-05-19 13:58:33.753673419 +0100 *************** *** 2,8 **** |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 ! |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| ! >w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 @22|7|,|1| @10|B|o|t| --- 2,8 ---- |L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 ! >L|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| ! |w|i|t|h| |s|o|m|e| |t|e|x|t| |w|i|t|h| |s|o|m|e| |t|e|x|t| @10 @22|7|,|1| @10|B|o|t| *** ../vim-9.0.1567/src/version.c 2023-05-19 13:20:30.823641841 +0100 --- src/version.c 2023-05-19 14:01:18.745806571 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1568, /**/ -- hundred-and-one symptoms of being an internet addict: 40. You tell the cab driver you live at http://123.elm.street/house/bluetrim.html 41. You actually try that 123.elm.street address. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///