summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0837
blob: 1e38391019e23c34420f4db4a3226c1f82ea68e2 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0837
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.0837
Problem:    Timer interrupting cursorhold and mapping not tested.
Solution:   Add tests with timers. (Ozaki Kiichi, closes #3871)
Files:	    src/testdir/test_autocmd.vim, src/testdir/test_mapping.vim


*** ../vim-8.1.0836/src/testdir/test_autocmd.vim	2019-01-24 21:57:11.574719854 +0100
--- src/testdir/test_autocmd.vim	2019-01-27 22:30:22.173169702 +0100
***************
*** 32,37 ****
--- 32,59 ----
      call timer_start(100, 'ExitInsertMode')
      call feedkeys('a', 'x!')
      call assert_equal(1, g:triggered)
+     unlet g:triggered
+     au! CursorHoldI
+     set updatetime&
+   endfunc
+ 
+   func Test_cursorhold_insert_with_timer_interrupt()
+     if !has('job')
+       return
+     endif
+     " Need to move the cursor.
+     call feedkeys("ggG", "xt")
+ 
+     " Confirm the timer invoked in exit_cb of the job doesn't disturb
+     " CursorHoldI event.
+     let g:triggered = 0
+     au CursorHoldI * let g:triggered += 1
+     set updatetime=500
+     call job_start(has('win32') ? 'cmd /c echo:' : 'echo',
+           \ {'exit_cb': {j, s -> timer_start(1000, 'ExitInsertMode')}})
+     call feedkeys('a', 'x!')
+     call assert_equal(1, g:triggered)
+     unlet g:triggered
      au! CursorHoldI
      set updatetime&
    endfunc
***************
*** 44,49 ****
--- 66,72 ----
      " CursorHoldI does not trigger after CTRL-X
      call feedkeys("a\<C-X>", 'x!')
      call assert_equal(0, g:triggered)
+     unlet g:triggered
      au! CursorHoldI
      set updatetime&
    endfunc
***************
*** 452,458 ****
  endfunc
  
  func Test_OptionSet()
!   if !has("eval") || !has("autocmd") || !exists("+autochdir")
      return
    endif
  
--- 475,481 ----
  endfunc
  
  func Test_OptionSet()
!   if !has("eval") || !exists("+autochdir")
      return
    endif
  
***************
*** 595,601 ****
  
  func Test_OptionSet_diffmode()
    call test_override('starting', 1)
!   " 18: Changing an option when enetering diff mode
    new
    au OptionSet diff :let &l:cul=v:option_new
  
--- 618,624 ----
  
  func Test_OptionSet_diffmode()
    call test_override('starting', 1)
!   " 18: Changing an option when entering diff mode
    new
    au OptionSet diff :let &l:cul=v:option_new
  
*** ../vim-8.1.0836/src/testdir/test_mapping.vim	2019-01-24 17:59:35.139217458 +0100
--- src/testdir/test_mapping.vim	2019-01-27 22:30:22.173169702 +0100
***************
*** 1,5 ****
--- 1,7 ----
  " Tests for mappings and abbreviations
  
+ source shared.vim
+ 
  func Test_abbreviation()
    " abbreviation with 0x80 should work
    inoreab чкпр   vim
***************
*** 169,174 ****
--- 171,179 ----
  endfunc
  
  func Test_map_timeout()
+   if !has('timers')
+     return
+   endif
    nnoremap aaaa :let got_aaaa = 1<CR>
    nnoremap bb :let got_bb = 1<CR>
    nmap b aaa
***************
*** 178,184 ****
      call feedkeys("\<Esc>", "t")
    endfunc
    set timeout timeoutlen=200
!   call timer_start(300, 'ExitInsert')
    " After the 'b' Vim waits for another character to see if it matches 'bb'.
    " When it times out it is expanded to "aaa", but there is no wait for
    " "aaaa".  Can't check that reliably though.
--- 183,189 ----
      call feedkeys("\<Esc>", "t")
    endfunc
    set timeout timeoutlen=200
!   let timer = timer_start(300, 'ExitInsert')
    " After the 'b' Vim waits for another character to see if it matches 'bb'.
    " When it times out it is expanded to "aaa", but there is no wait for
    " "aaaa".  Can't check that reliably though.
***************
*** 193,198 ****
--- 198,236 ----
    nunmap b
    set timeoutlen&
    delfunc ExitInsert
+   call timer_stop(timer)
+ endfunc
+ 
+ func Test_map_timeout_with_timer_interrupt()
+   if !has('job') || !has('timers')
+     return
+   endif
+ 
+   " Confirm the timer invoked in exit_cb of the job doesn't disturb mapped key
+   " sequence.
+   new
+   let g:val = 0
+   nnoremap \12 :let g:val = 1<CR>
+   nnoremap \123 :let g:val = 2<CR>
+   set timeout timeoutlen=1000
+ 
+   func ExitCb(job, status)
+     let g:timer = timer_start(1, {_ -> feedkeys("3\<Esc>", 't')})
+   endfunc
+ 
+   call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'})
+   call feedkeys('\12', 'xt!')
+   call assert_equal(2, g:val)
+ 
+   bwipe!
+   nunmap \12
+   nunmap \123
+   set timeoutlen&
+   call WaitFor({-> exists('g:timer')})
+   call timer_stop(g:timer)
+   unlet g:timer
+   unlet g:val
+   delfunc ExitCb
  endfunc
  
  func Test_abbreviation_CR()
*** ../vim-8.1.0836/src/version.c	2019-01-27 20:43:38.135329194 +0100
--- src/version.c	2019-01-27 22:31:38.552579694 +0100
***************
*** 785,786 ****
--- 785,788 ----
  {   /* Add new patch number below this line */
+ /**/
+     837,
  /**/

-- 
A computer programmer is a device for turning requirements into
undocumented features.  It runs on cola, pizza and Dilbert cartoons.
					Bram Moolenaar

 /// 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    ///