summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1137
blob: 143a465679c06c312a274795fbdc721e0c8ab6de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1137
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1137
Problem:    Xterm mouse wheel escape sequence is not tested.
Solution:   Add a test using low-level input. (Dominique Pelle, closes #4221)
Files:	    src/testdir/test_termcodes.vim


*** ../vim-8.1.1136/src/testdir/test_termcodes.vim	2019-04-07 14:21:26.226339351 +0200
--- src/testdir/test_termcodes.vim	2019-04-07 21:52:38.692856529 +0200
***************
*** 45,47 ****
--- 45,113 ----
    bwipe!
  endfunc
  
+ func Test_xterm_mouse_wheel()
+   new
+   let save_mouse = &mouse
+   let save_term = &term
+   let save_ttymouse = &ttymouse
+   set mouse=a
+   set term=xterm
+   call setline(1, range(1, 100))
+ 
+   " Test Xterm mouse wheel.
+   set ttymouse=xterm
+   let button = 0x41 " wheel down.
+   let row = 1 + 32  " cursor position for mouse wheel is not relevant.
+   let col = 1 + 32
+ 
+   call assert_equal(1, line('w0'))
+   call assert_equal([0, 1, 1, 0], getpos('.'))
+   call feedkeys("\<Esc>[M" .. list2str([button, col, row]), 'Lx!')
+   call assert_equal(4, line('w0'))
+   call assert_equal([0, 4, 1, 0], getpos('.'))
+   call feedkeys("\<Esc>[M" .. list2str([button, col, row]), 'Lx!')
+   call assert_equal(7, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+ 
+   let button = 0x40  " wheel up.
+ 
+   call feedkeys("\<Esc>[M" .. list2str([button, col, row]), 'Lx!')
+   call assert_equal(4, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+   call feedkeys("\<Esc>[M" .. list2str([button, col, row]), 'Lx!')
+   call assert_equal(1, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+ 
+   " Test SGR mouse wheel.
+   set ttymouse=sgr
+   go
+   let button = 0x41 " wheel down.
+   let row = 1       " cursor position for mouse wheel is not relevant.
+   let col = 1
+ 
+   call assert_equal(1, line('w0'))
+   call assert_equal([0, 1, 1, 0], getpos('.'))
+   call feedkeys(printf("\<Esc>[<%d;%d;%dM", button, col, row), 'Lx!')
+   call assert_equal(4, line('w0'))
+   call assert_equal([0, 4, 1, 0], getpos('.'))
+   call feedkeys(printf("\<Esc>[<%d;%d;%dM", button, col, row), 'Lx!')
+   call assert_equal(7, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+ 
+   let button = 0x40  " wheel up.
+ 
+   call feedkeys(printf("\<Esc>[<%d;%d;%dM", button, col, row), 'Lx!')
+   call assert_equal(4, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+   call feedkeys(printf("\<Esc>[<%d;%d;%dM", button, col, row), 'Lx!')
+   call assert_equal(1, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+   call feedkeys(printf("\<Esc>[<%d;%d;%dM", button, col, row), 'Lx!')
+   call assert_equal(1, line('w0'))
+   call assert_equal([0, 7, 1, 0], getpos('.'))
+ 
+   let &mouse = save_mouse
+   let &term = save_term
+   let &ttymouse = save_ttymouse
+   bwipe!
+ endfunc
*** ../vim-8.1.1136/src/version.c	2019-04-07 14:21:26.230339328 +0200
--- src/version.c	2019-04-07 21:53:40.908539048 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1137,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor.  Or on top of it.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///