Patch 8.1.2106
Problem:    No tests for dragging the mouse beyond the window.
Solution:   Add a test. (Dominique Pelle, closes #5004)
Files:      src/testdir/test_termcodes.vim


*** ../vim-8.1.2105/src/testdir/test_termcodes.vim      2019-09-08 
18:58:39.557952948 +0200
--- src/testdir/test_termcodes.vim      2019-10-01 14:17:20.745515750 +0200
***************
*** 166,177 ****
      call MouseCtrlLeftClick(row, col)
      call MouseLeftRelease(row, col)
      call assert_match('usr_02.txt$', bufname('%'), msg)
!     call assert_equal('*usr_02.txt*', expand('<cWORD>'))
  
      call MouseCtrlRightClick(row, col)
      call MouseRightRelease(row, col)
      call assert_match('help.txt$', bufname('%'), msg)
!     call assert_equal('|usr_02.txt|', expand('<cWORD>'))
  
      helpclose
    endfor
--- 166,177 ----
      call MouseCtrlLeftClick(row, col)
      call MouseLeftRelease(row, col)
      call assert_match('usr_02.txt$', bufname('%'), msg)
!     call assert_equal('*usr_02.txt*', expand('<cWORD>'), msg)
  
      call MouseCtrlRightClick(row, col)
      call MouseRightRelease(row, col)
      call assert_match('help.txt$', bufname('%'), msg)
!     call assert_equal('|usr_02.txt|', expand('<cWORD>'), msg)
  
      helpclose
    endfor
***************
*** 267,272 ****
--- 267,359 ----
    bwipe!
  endfunc
  
+ " Test that dragging beyond the window (at the bottom and at the top)
+ " scrolls window content by the number of of lines beyond the window.
+ func Test_term_mouse_drag_beyond_window()
+   let save_mouse = &mouse
+   let save_term = &term
+   let save_ttymouse = &ttymouse
+   call test_override('no_query_mouse', 1)
+   set mouse=a term=xterm
+   let col = 1
+   call setline(1, range(1, 100))
+ 
+   " Split into 3 windows, and go into the middle window
+   " so we test dragging mouse below and above the window.
+   2split
+   wincmd j
+   2split
+ 
+   for ttymouse_val in s:ttymouse_values + s:ttymouse_dec
+     let msg = 'ttymouse=' .. ttymouse_val
+     exe 'set ttymouse=' .. ttymouse_val
+ 
+     " Line #10 at the top.
+     norm! 10zt
+     redraw
+     call assert_equal(10, winsaveview().topline, msg)
+     call assert_equal(2, winheight(0), msg)
+ 
+     let row = 4
+     call MouseLeftClick(row, col)
+     call assert_equal(10, winsaveview().topline, msg)
+ 
+     " Drag downwards. We're still in the window so topline should
+     " not change yet.
+     let row += 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(10, winsaveview().topline, msg)
+ 
+     " We now leave the window at the bottom, so the window content should
+     " scroll by 1 line, then 2 lines (etc) as we drag further away.
+     let row += 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(11, winsaveview().topline, msg)
+ 
+     let row += 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(13, winsaveview().topline, msg)
+ 
+     " Now drag upwards.
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(14, winsaveview().topline, msg)
+ 
+     " We're now back in the window so the topline should not change.
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(14, winsaveview().topline, msg)
+ 
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(14, winsaveview().topline, msg)
+ 
+     " We now leave the window at the top so the window content should
+     " scroll by 1 line, then 2, then 3 (etc) in the opposite direction.
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(13, winsaveview().topline, msg)
+ 
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(11, winsaveview().topline, msg)
+ 
+     let row -= 1
+     call MouseLeftDrag(row, col)
+     call assert_equal(8, winsaveview().topline, msg)
+ 
+     call MouseLeftRelease(row, col)
+     call assert_equal(8, winsaveview().topline, msg)
+     call assert_equal(2, winheight(0), msg)
+   endfor
+ 
+   let &mouse = save_mouse
+   let &term = save_term
+   let &ttymouse = save_ttymouse
+   call test_override('no_query_mouse', 0)
+   bwipe!
+ endfunc
+ 
  func Test_term_mouse_drag_window_separator()
    let save_mouse = &mouse
    let save_term = &term
*** ../vim-8.1.2105/src/version.c       2019-10-01 12:10:19.951160320 +0200
--- src/version.c       2019-10-01 14:18:28.249293351 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     2106,
  /**/

-- 
FATHER:    You killed eight wedding guests in all!
LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
FATHER:    I can understand that.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/201910011219.x91CJsJ2011199%40masaka.moolenaar.net.

Raspunde prin e-mail lui