To: vim_dev@googlegroups.com Subject: Patch 9.0.0998 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0998 Problem: "gk" may reset skipcol when not needed. Solution: Only reset skipcol if the cursor column is less. Files: src/move.c, src/testdir/test_scroll_opt.vim *** ../vim-9.0.0997/src/move.c 2022-12-02 20:46:01.936019457 +0000 --- src/move.c 2022-12-03 11:42:40.613781863 +0000 *************** *** 2343,2349 **** { /* * If "always" is FALSE, only adjust topline to a lower value, higher ! * value may happen with wrapping lines */ if (new_topline < curwin->w_topline || always) curwin->w_topline = new_topline; --- 2343,2349 ---- { /* * If "always" is FALSE, only adjust topline to a lower value, higher ! * value may happen with wrapping lines. */ if (new_topline < curwin->w_topline || always) curwin->w_topline = new_topline; *************** *** 2360,2366 **** check_topfill(curwin, FALSE); #endif // TODO: if the line doesn't fit may optimize w_skipcol ! if (curwin->w_topline == curwin->w_cursor.lnum) reset_skipcol(); if (curwin->w_topline != old_topline || curwin->w_skipcol != old_skipcol --- 2360,2367 ---- check_topfill(curwin, FALSE); #endif // TODO: if the line doesn't fit may optimize w_skipcol ! if (curwin->w_topline == curwin->w_cursor.lnum ! && curwin->w_skipcol >= curwin->w_cursor.col) reset_skipcol(); if (curwin->w_topline != old_topline || curwin->w_skipcol != old_skipcol *** ../vim-9.0.0997/src/testdir/test_scroll_opt.vim 2022-11-19 14:31:04.356796241 +0000 --- src/testdir/test_scroll_opt.vim 2022-12-03 11:50:07.197468088 +0000 *************** *** 359,364 **** --- 359,370 ---- call StopVimInTerminal(buf) endfunc + func s:check_col_calc(win_col, win_line, buf_col) + call assert_equal(a:win_col, wincol()) + call assert_equal(a:win_line, winline()) + call assert_equal(a:buf_col, col('.')) + endfunc + " Test that if the current cursor is on a smooth scrolled line, we correctly " reposition it. Also check that we don't miscalculate the values by checking " the consistency between wincol() and col('.') as they are calculated *************** *** 368,379 **** setl smoothscroll wrap call setline(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") - func s:check_col_calc(win_col, win_line, buf_col) - call assert_equal(a:win_col, wincol()) - call assert_equal(a:win_line, winline()) - call assert_equal(a:buf_col, col('.')) - endfunc - call s:check_col_calc(1, 1, 1) exe "normal \" --- 374,379 ---- *************** *** 450,458 **** call s:check_col_calc(1, 3, 37) normal gg ! bwipeout! endfunc " Test that mouse picking is still accurate when we have smooth scrolled lines func Test_smoothscroll_mouse_pos() CheckNotGui --- 450,490 ---- call s:check_col_calc(1, 3, 37) normal gg ! bwipe! ! endfunc ! ! func Test_smoothscroll_cursor_scrolloff() ! call NewWindow(10, 20) ! setl smoothscroll wrap ! setl scrolloff=3 ! ! " 120 chars are 6 screen lines ! call setline(1, "abcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRST") ! call setline(2, "below") ! ! call s:check_col_calc(1, 1, 1) ! ! " CTRL-E shows "<<" ! call s:check_col_calc(1, 4, 81) ! ! " cursor on start of second line, "gk" moves into first line, skipcol doesn't ! " change ! exe "normal G0gk" ! call s:check_col_calc(1, 5, 101) ! ! " move cursor left one window width worth, scrolls one screen line ! exe "normal 20h" ! call s:check_col_calc(1, 5, 81) ! ! " move cursor left one window width worth, scrolls one screen line ! exe "normal 20h" ! call s:check_col_calc(1, 4, 61) ! ! bwipe! endfunc + " Test that mouse picking is still accurate when we have smooth scrolled lines func Test_smoothscroll_mouse_pos() CheckNotGui *** ../vim-9.0.0997/src/version.c 2022-12-03 10:13:26.322949264 +0000 --- src/version.c 2022-12-03 11:17:54.974610535 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 998, /**/ -- hundred-and-one symptoms of being an internet addict: 217. Your sex life has drastically improved...so what if it's only cyber-sex! /// 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 ///