Patch 8.2.4803
Problem:    WinScrolled not always triggered when scrolling with the mouse.
Solution:   Add calls to may_trigger_winscrolled(). (closes #10246)
Files:      src/mouse.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.4802/src/mouse.c 2022-04-05 13:16:57.540981208 +0100
--- src/mouse.c 2022-04-21 22:48:08.010228797 +0100
***************
*** 1127,1132 ****
--- 1127,1133 ----
        }
  #endif
        did_scroll = TRUE;
+       may_trigger_winscrolled();
      }
  
      curwin->w_redr_status = TRUE;
***************
*** 2087,2092 ****
--- 2088,2094 ----
      if (curwin != old_curwin && curwin->w_p_cul)
        redraw_for_cursorline(curwin);
  # endif
+     may_trigger_winscrolled();
  
      curwin->w_redr_status = TRUE;
  
*** ../vim-8.2.4802/src/testdir/test_autocmd.vim        2022-04-21 
11:13:56.482271279 +0100
--- src/testdir/test_autocmd.vim        2022-04-21 22:48:08.010228797 +0100
***************
*** 364,369 ****
--- 364,400 ----
    call delete('Xtest_winscrolled')
  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()
    CheckRunVimInTerminal
  
***************
*** 1572,1578 ****
    " Close the other window, <afile> should be correct.
    exe win_id2win(winid) . 'q'
    call assert_equal('Xfoo', g:afile)
!  
    unlet g:afile
    bwipe Xfoo
    bwipe Xbar
--- 1603,1609 ----
    " Close the other window, <afile> should be correct.
    exe win_id2win(winid) . 'q'
    call assert_equal('Xfoo', g:afile)
! 
    unlet g:afile
    bwipe Xfoo
    bwipe Xbar
*** ../vim-8.2.4802/src/version.c       2022-04-21 11:13:56.482271279 +0100
--- src/version.c       2022-04-21 22:49:40.790283074 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4803,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
33. You name your children Eudora, Mozilla and Dotcom.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220421215250.C90B21C40C6%40moolenaar.net.

Raspunde prin e-mail lui