Mercurial > vim
comparison src/testdir/test_paste.vim @ 28627:da77eb586899 v8.2.4837
patch 8.2.4837: modifiers not simplified when timed out
Commit: https://github.com/vim/vim/commit/68a573ce2b996602a86b14d9b258ebb8c657604f
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Apr 28 14:10:01 2022 +0100
patch 8.2.4837: modifiers not simplified when timed out
Problem: Modifiers not simplified when timed out or using feedkeys() with
'n" flag.
Solution: Adjust how mapped flag and timeout are used. (closes #10305)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Apr 2022 15:15:03 +0200 |
parents | 7976d709c963 |
children | 457ea0570b6f |
comparison
equal
deleted
inserted
replaced
28626:46322b66ebb6 | 28627:da77eb586899 |
---|---|
1 " Tests for bracketed paste and other forms of pasting. | 1 " Tests for bracketed paste and other forms of pasting. |
2 | 2 |
3 " Bracketed paste only works with "xterm". Not in GUI or Windows console. | 3 " Bracketed paste only works with "xterm". Not in GUI or Windows console. |
4 source check.vim | 4 source check.vim |
5 source term_util.vim | |
5 CheckNotMSWindows | 6 CheckNotMSWindows |
6 CheckNotGui | 7 CheckNotGui |
7 | 8 |
8 set term=xterm | 9 set term=xterm |
9 | 10 |
215 call assert_equal('"set pastetoggle=<F4>', @:) | 216 call assert_equal('"set pastetoggle=<F4>', @:) |
216 set pastetoggle& | 217 set pastetoggle& |
217 bwipe! | 218 bwipe! |
218 endfunc | 219 endfunc |
219 | 220 |
221 func Test_pastetoggle_timeout_no_typed_after_mapped() | |
222 CheckRunVimInTerminal | |
223 | |
224 let lines =<< trim END | |
225 set pastetoggle=abc | |
226 set ttimeoutlen=10000 | |
227 imap d a | |
228 END | |
229 call writefile(lines, 'Xpastetoggle_no_typed_after_mapped.vim') | |
230 let buf = RunVimInTerminal('-S Xpastetoggle_no_typed_after_mapped.vim', #{rows: 8}) | |
231 call TermWait(buf) | |
232 call term_sendkeys(buf, ":call feedkeys('id', 't')\<CR>") | |
233 call term_wait(buf, 200) | |
234 call term_sendkeys(buf, 'bc') | |
235 " 'ttimeoutlen' should NOT apply | |
236 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 8))}) | |
237 | |
238 call StopVimInTerminal(buf) | |
239 call delete('Xpastetoggle_no_typed_after_mapped.vim') | |
240 endfunc | |
241 | |
242 func Test_pastetoggle_timeout_typed_after_mapped() | |
243 CheckRunVimInTerminal | |
244 | |
245 let lines =<< trim END | |
246 set pastetoggle=abc | |
247 set ttimeoutlen=10000 | |
248 imap d a | |
249 END | |
250 call writefile(lines, 'Xpastetoggle_typed_after_mapped.vim') | |
251 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_mapped.vim', #{rows: 8}) | |
252 call TermWait(buf) | |
253 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>") | |
254 call term_wait(buf, 200) | |
255 call term_sendkeys(buf, 'c') | |
256 " 'ttimeoutlen' should apply | |
257 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))}) | |
258 | |
259 call StopVimInTerminal(buf) | |
260 call delete('Xpastetoggle_typed_after_mapped.vim') | |
261 endfunc | |
262 | |
263 func Test_pastetoggle_timeout_typed_after_noremap() | |
264 CheckRunVimInTerminal | |
265 | |
266 let lines =<< trim END | |
267 set pastetoggle=abc | |
268 set ttimeoutlen=10000 | |
269 inoremap d a | |
270 END | |
271 call writefile(lines, 'Xpastetoggle_typed_after_noremap.vim') | |
272 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_noremap.vim', #{rows: 8}) | |
273 call TermWait(buf) | |
274 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>") | |
275 call term_wait(buf, 200) | |
276 call term_sendkeys(buf, 'c') | |
277 " 'ttimeoutlen' should apply | |
278 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))}) | |
279 | |
280 call StopVimInTerminal(buf) | |
281 call delete('Xpastetoggle_typed_after_noremap.vim') | |
282 endfunc | |
283 | |
220 " Test for restoring option values when 'paste' is disabled | 284 " Test for restoring option values when 'paste' is disabled |
221 func Test_paste_opt_restore() | 285 func Test_paste_opt_restore() |
222 set autoindent expandtab ruler showmatch | 286 set autoindent expandtab ruler showmatch |
223 if has('rightleft') | 287 if has('rightleft') |
224 set revins hkmap | 288 set revins hkmap |