mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Problem: WinScrolled is not triggered when only skipcol changes. Solution: Add w_last_skipcol and use it. (closes #10998)
This commit is contained in:
@@ -1249,6 +1249,7 @@ do_autocmd_event(
|
|||||||
{
|
{
|
||||||
curwin->w_last_topline = curwin->w_topline;
|
curwin->w_last_topline = curwin->w_topline;
|
||||||
curwin->w_last_leftcol = curwin->w_leftcol;
|
curwin->w_last_leftcol = curwin->w_leftcol;
|
||||||
|
curwin->w_last_skipcol = curwin->w_skipcol;
|
||||||
curwin->w_last_width = curwin->w_width;
|
curwin->w_last_width = curwin->w_width;
|
||||||
curwin->w_last_height = curwin->w_height;
|
curwin->w_last_height = curwin->w_height;
|
||||||
}
|
}
|
||||||
|
@@ -3542,9 +3542,10 @@ struct window_S
|
|||||||
// window
|
// window
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// four fields that are only used when there is a WinScrolled autocommand
|
// five fields that are only used when there is a WinScrolled autocommand
|
||||||
linenr_T w_last_topline; // last known value for w_topline
|
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_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_width; // last known value for w_width
|
||||||
int w_last_height; // last known value for w_height
|
int w_last_height; // last known value for w_height
|
||||||
|
|
||||||
|
@@ -419,6 +419,39 @@ func Test_WinScrolled_close_curwin()
|
|||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
endfunc
|
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\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^0 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, 'gj')
|
||||||
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^1 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, '0')
|
||||||
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^2 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call term_sendkeys(buf, '$')
|
||||||
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
|
call delete('Xtest_winscrolled_long_wrapped')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_WinClosed()
|
func Test_WinClosed()
|
||||||
" Test that the pattern is matched against the closed window's ID, and both
|
" Test that the pattern is matched against the closed window's ID, and both
|
||||||
" <amatch> and <afile> are set to it.
|
" <amatch> and <afile> are set to it.
|
||||||
|
@@ -707,6 +707,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
304,
|
||||||
/**/
|
/**/
|
||||||
303,
|
303,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -2806,6 +2806,7 @@ may_trigger_winscrolled(void)
|
|||||||
|
|
||||||
if (wp->w_last_topline != wp->w_topline
|
if (wp->w_last_topline != wp->w_topline
|
||||||
|| wp->w_last_leftcol != wp->w_leftcol
|
|| wp->w_last_leftcol != wp->w_leftcol
|
||||||
|
|| wp->w_last_skipcol != wp->w_skipcol
|
||||||
|| wp->w_last_width != wp->w_width
|
|| wp->w_last_width != wp->w_width
|
||||||
|| wp->w_last_height != wp->w_height)
|
|| wp->w_last_height != wp->w_height)
|
||||||
{
|
{
|
||||||
@@ -2820,6 +2821,7 @@ may_trigger_winscrolled(void)
|
|||||||
{
|
{
|
||||||
wp->w_last_topline = wp->w_topline;
|
wp->w_last_topline = wp->w_topline;
|
||||||
wp->w_last_leftcol = wp->w_leftcol;
|
wp->w_last_leftcol = wp->w_leftcol;
|
||||||
|
wp->w_last_skipcol = wp->w_skipcol;
|
||||||
wp->w_last_width = wp->w_width;
|
wp->w_last_width = wp->w_width;
|
||||||
wp->w_last_height = wp->w_height;
|
wp->w_last_height = wp->w_height;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user