mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Problem: WinScrolled not always triggered when scrolling with the mouse. Solution: Add calls to may_trigger_winscrolled(). (closes #10246)
This commit is contained in:
@@ -1127,6 +1127,7 @@ ins_mousescroll(int dir)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
did_scroll = TRUE;
|
did_scroll = TRUE;
|
||||||
|
may_trigger_winscrolled();
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_redr_status = TRUE;
|
curwin->w_redr_status = TRUE;
|
||||||
@@ -2087,6 +2088,7 @@ nv_mousescroll(cmdarg_T *cap)
|
|||||||
if (curwin != old_curwin && curwin->w_p_cul)
|
if (curwin != old_curwin && curwin->w_p_cul)
|
||||||
redraw_for_cursorline(curwin);
|
redraw_for_cursorline(curwin);
|
||||||
# endif
|
# endif
|
||||||
|
may_trigger_winscrolled();
|
||||||
|
|
||||||
curwin->w_redr_status = TRUE;
|
curwin->w_redr_status = TRUE;
|
||||||
|
|
||||||
|
@@ -364,6 +364,37 @@ func Test_WinScrolled()
|
|||||||
call delete('Xtest_winscrolled')
|
call delete('Xtest_winscrolled')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_WinScrolled_mouse()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set nowrap scrolloff=0
|
||||||
|
set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard=
|
||||||
|
call setline(1, ['foo']->repeat(32))
|
||||||
|
split
|
||||||
|
let g:scrolled = 0
|
||||||
|
au WinScrolled * let g:scrolled += 1
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xtest_winscrolled_mouse')
|
||||||
|
let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10})
|
||||||
|
|
||||||
|
" With the upper split focused, send a scroll-down event to the unfocused one.
|
||||||
|
call test_setmouse(7, 1)
|
||||||
|
call term_sendkeys(buf, "\<ScrollWheelDown>")
|
||||||
|
call TermWait(buf)
|
||||||
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^1', term_getline(buf, 10))}, 1000)
|
||||||
|
|
||||||
|
" Again, but this time while we're in insert mode.
|
||||||
|
call term_sendkeys(buf, "i\<ScrollWheelDown>\<Esc>")
|
||||||
|
call TermWait(buf)
|
||||||
|
call term_sendkeys(buf, ":echo g:scrolled\<CR>")
|
||||||
|
call WaitForAssert({-> assert_match('^2', term_getline(buf, 10))}, 1000)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xtest_winscrolled_mouse')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_WinScrolled_close_curwin()
|
func Test_WinScrolled_close_curwin()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4803,
|
||||||
/**/
|
/**/
|
||||||
4802,
|
4802,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user