To: vim_dev@googlegroups.com Subject: Patch 9.0.0304 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0304 Problem: WinScrolled is not triggered when only skipcol changes. Solution: Add w_last_skipcol and use it. (closes #10998) Files: src/autocmd.c, src/structs.h, src/window.c, src/testdir/test_autocmd.vim *** ../vim-9.0.0303/src/autocmd.c 2022-07-23 09:52:00.333814262 +0100 --- src/autocmd.c 2022-08-28 19:09:15.368723316 +0100 *************** *** 1249,1254 **** --- 1249,1255 ---- { curwin->w_last_topline = curwin->w_topline; curwin->w_last_leftcol = curwin->w_leftcol; + curwin->w_last_skipcol = curwin->w_skipcol; curwin->w_last_width = curwin->w_width; curwin->w_last_height = curwin->w_height; } *** ../vim-9.0.0303/src/structs.h 2022-08-27 21:29:28.257402847 +0100 --- src/structs.h 2022-08-28 19:12:17.388802632 +0100 *************** *** 3542,3550 **** // window #endif ! // four fields that are only used when there is a WinScrolled autocommand linenr_T w_last_topline; // last known value for w_topline colnr_T w_last_leftcol; // last known value for w_leftcol int w_last_width; // last known value for w_width int w_last_height; // last known value for w_height --- 3542,3551 ---- // window #endif ! // five fields that are only used when there is a WinScrolled autocommand linenr_T w_last_topline; // last known value for w_topline colnr_T w_last_leftcol; // last known value for w_leftcol + colnr_T w_last_skipcol; // last known value for w_skipcol int w_last_width; // last known value for w_width int w_last_height; // last known value for w_height *** ../vim-9.0.0303/src/window.c 2022-08-28 13:02:23.955786926 +0100 --- src/window.c 2022-08-28 19:09:15.372723320 +0100 *************** *** 2806,2811 **** --- 2806,2812 ---- if (wp->w_last_topline != wp->w_topline || wp->w_last_leftcol != wp->w_leftcol + || wp->w_last_skipcol != wp->w_skipcol || wp->w_last_width != wp->w_width || wp->w_last_height != wp->w_height) { *************** *** 2820,2825 **** --- 2821,2827 ---- { wp->w_last_topline = wp->w_topline; wp->w_last_leftcol = wp->w_leftcol; + wp->w_last_skipcol = wp->w_skipcol; wp->w_last_width = wp->w_width; wp->w_last_height = wp->w_height; } *** ../vim-9.0.0303/src/testdir/test_autocmd.vim 2022-08-26 15:34:48.244902157 +0100 --- src/testdir/test_autocmd.vim 2022-08-28 19:09:15.372723320 +0100 *************** *** 419,424 **** --- 419,457 ---- call delete('Xtestout') endfunc + func Test_WinScrolled_long_wrapped() + CheckRunVimInTerminal + + let lines =<< trim END + set scrolloff=0 + let height = winheight(0) + let width = winwidth(0) + let g:scrolled = 0 + au WinScrolled * let g:scrolled += 1 + call setline(1, repeat('foo', height * width)) + call cursor(1, height * width) + END + call writefile(lines, 'Xtest_winscrolled_long_wrapped') + let buf = RunVimInTerminal('-S Xtest_winscrolled_long_wrapped', {'rows': 6}) + + call term_sendkeys(buf, ":echo g:scrolled\") + call WaitForAssert({-> assert_match('^0 ', term_getline(buf, 6))}, 1000) + + call term_sendkeys(buf, 'gj') + call term_sendkeys(buf, ":echo g:scrolled\") + call WaitForAssert({-> assert_match('^1 ', term_getline(buf, 6))}, 1000) + + call term_sendkeys(buf, '0') + call term_sendkeys(buf, ":echo g:scrolled\") + call WaitForAssert({-> assert_match('^2 ', term_getline(buf, 6))}, 1000) + + call term_sendkeys(buf, '$') + call term_sendkeys(buf, ":echo g:scrolled\") + call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000) + + call delete('Xtest_winscrolled_long_wrapped') + endfunc + func Test_WinClosed() " Test that the pattern is matched against the closed window's ID, and both " and are set to it. *** ../vim-9.0.0303/src/version.c 2022-08-28 18:52:06.671888918 +0100 --- src/version.c 2022-08-28 19:13:15.304798008 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 304, /**/ -- A disclaimer for the disclaimer: "and before I get a huge amount of complaints , I have no control over the disclaimer at the end of this mail :-)" (Timothy Aldrich) /// 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 ///