comparison src/testdir/test_autocmd.vim @ 28558:2edad5db074c v8.2.4803

patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse Commit: https://github.com/vim/vim/commit/66e13aedc7986c83644d537a8fdd3cb006507678 Author: LemonBoy <thatlemon@gmail.com> Date: Thu Apr 21 22:52:11 2022 +0100 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 https://github.com/vim/vim/issues/10246)
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 Apr 2022 00:00:04 +0200
parents ea98e79c9677
children c5862dfaf0bd
comparison
equal deleted inserted replaced
28557:e5203e5669c9 28558:2edad5db074c
362 362
363 call StopVimInTerminal(buf) 363 call StopVimInTerminal(buf)
364 call delete('Xtest_winscrolled') 364 call delete('Xtest_winscrolled')
365 endfunc 365 endfunc
366 366
367 func Test_WinScrolled_mouse()
368 CheckRunVimInTerminal
369
370 let lines =<< trim END
371 set nowrap scrolloff=0
372 set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard=
373 call setline(1, ['foo']->repeat(32))
374 split
375 let g:scrolled = 0
376 au WinScrolled * let g:scrolled += 1
377 END
378 call writefile(lines, 'Xtest_winscrolled_mouse')
379 let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10})
380
381 " With the upper split focused, send a scroll-down event to the unfocused one.
382 call test_setmouse(7, 1)
383 call term_sendkeys(buf, "\<ScrollWheelDown>")
384 call TermWait(buf)
385 call term_sendkeys(buf, ":echo g:scrolled\<CR>")
386 call WaitForAssert({-> assert_match('^1', term_getline(buf, 10))}, 1000)
387
388 " Again, but this time while we're in insert mode.
389 call term_sendkeys(buf, "i\<ScrollWheelDown>\<Esc>")
390 call TermWait(buf)
391 call term_sendkeys(buf, ":echo g:scrolled\<CR>")
392 call WaitForAssert({-> assert_match('^2', term_getline(buf, 10))}, 1000)
393
394 call StopVimInTerminal(buf)
395 call delete('Xtest_winscrolled_mouse')
396 endfunc
397
367 func Test_WinScrolled_close_curwin() 398 func Test_WinScrolled_close_curwin()
368 CheckRunVimInTerminal 399 CheckRunVimInTerminal
369 400
370 let lines =<< trim END 401 let lines =<< trim END
371 set nowrap scrolloff=0 402 set nowrap scrolloff=0
1570 split Xbar 1601 split Xbar
1571 au! QuitPre * let g:afile = expand('<afile>') 1602 au! QuitPre * let g:afile = expand('<afile>')
1572 " Close the other window, <afile> should be correct. 1603 " Close the other window, <afile> should be correct.
1573 exe win_id2win(winid) . 'q' 1604 exe win_id2win(winid) . 'q'
1574 call assert_equal('Xfoo', g:afile) 1605 call assert_equal('Xfoo', g:afile)
1575 1606
1576 unlet g:afile 1607 unlet g:afile
1577 bwipe Xfoo 1608 bwipe Xfoo
1578 bwipe Xbar 1609 bwipe Xbar
1579 endfunc 1610 endfunc
1580 1611