Mercurial > vim
comparison src/testdir/test_functions.vim @ 10787:09926123316b v8.0.0283
patch 8.0.0283: mode() does not indicate Insert mode completion
commit https://github.com/vim/vim/commit/e90858d0229444b3cd16b1cd3a8d61a24c435705
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 1 17:24:34 2017 +0100
patch 8.0.0283: mode() does not indicate Insert mode completion
Problem: The return value of mode() does not indicate that completion is
active in Replace and Insert mode. (Zhen-Huan (Kenny) Hu)
Solution: Add "c" or "x" for two kinds of completion. (Yegappan Lakshmanan,
closes #1397) Test some more modes.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 01 Feb 2017 17:30:05 +0100 |
parents | 8779b4b2e958 |
children | d66e5446cc48 |
comparison
equal
deleted
inserted
replaced
10786:b9b55becad75 | 10787:09926123316b |
---|---|
302 call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) | 302 call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) |
303 | 303 |
304 call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) | 304 call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) |
305 endfunc | 305 endfunc |
306 | 306 |
307 | 307 " Tests for the mode() function |
308 let current_modes = '' | |
309 func! Save_mode() | |
310 let g:current_modes = mode(0) . '-' . mode(1) | |
311 return '' | |
312 endfunc | |
313 | |
314 func! Test_mode() | |
315 new | |
316 call append(0, ["Blue Ball Black", "Brown Band Bowl", ""]) | |
317 | |
318 inoremap <F2> <C-R>=Save_mode()<CR> | |
319 | |
320 normal! 3G | |
321 exe "normal i\<F2>\<Esc>" | |
322 call assert_equal('i-i', g:current_modes) | |
323 exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u" | |
324 call assert_equal('i-ic', g:current_modes) | |
325 exe "normal iBro\<C-P>\<F2>\<Esc>u" | |
326 call assert_equal('i-ic', g:current_modes) | |
327 exe "normal iBa\<C-X>\<F2>\<Esc>u" | |
328 call assert_equal('i-ix', g:current_modes) | |
329 exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u" | |
330 call assert_equal('i-ic', g:current_modes) | |
331 exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u" | |
332 call assert_equal('i-ic', g:current_modes) | |
333 exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u" | |
334 call assert_equal('i-ic', g:current_modes) | |
335 exe "normal iCom\<C-P>\<F2>\<Esc>u" | |
336 call assert_equal('i-ic', g:current_modes) | |
337 exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u" | |
338 call assert_equal('i-ic', g:current_modes) | |
339 | |
340 exe "normal RBa\<C-P>\<F2>\<Esc>u" | |
341 call assert_equal('R-Rc', g:current_modes) | |
342 exe "normal RBro\<C-P>\<F2>\<Esc>u" | |
343 call assert_equal('R-Rc', g:current_modes) | |
344 exe "normal RBa\<C-X>\<F2>\<Esc>u" | |
345 call assert_equal('R-Rx', g:current_modes) | |
346 exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u" | |
347 call assert_equal('R-Rc', g:current_modes) | |
348 exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u" | |
349 call assert_equal('R-Rc', g:current_modes) | |
350 exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u" | |
351 call assert_equal('R-Rc', g:current_modes) | |
352 exe "normal RCom\<C-P>\<F2>\<Esc>u" | |
353 call assert_equal('R-Rc', g:current_modes) | |
354 exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u" | |
355 call assert_equal('R-Rc', g:current_modes) | |
356 | |
357 call assert_equal('n', mode(0)) | |
358 call assert_equal('n', mode(1)) | |
359 | |
360 " How to test operator-pending mode? | |
361 | |
362 call feedkeys("v", 'xt') | |
363 call assert_equal('v', mode()) | |
364 call assert_equal('v', mode(1)) | |
365 call feedkeys("\<Esc>V", 'xt') | |
366 call assert_equal('V', mode()) | |
367 call assert_equal('V', mode(1)) | |
368 call feedkeys("\<Esc>\<C-V>", 'xt') | |
369 call assert_equal("\<C-V>", mode()) | |
370 call assert_equal("\<C-V>", mode(1)) | |
371 call feedkeys("\<Esc>", 'xt') | |
372 | |
373 call feedkeys("gh", 'xt') | |
374 call assert_equal('s', mode()) | |
375 call assert_equal('s', mode(1)) | |
376 call feedkeys("\<Esc>gH", 'xt') | |
377 call assert_equal('S', mode()) | |
378 call assert_equal('S', mode(1)) | |
379 call feedkeys("\<Esc>g\<C-H>", 'xt') | |
380 call assert_equal("\<C-S>", mode()) | |
381 call assert_equal("\<C-S>", mode(1)) | |
382 call feedkeys("\<Esc>", 'xt') | |
383 | |
384 call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt') | |
385 call assert_equal('c-c', g:current_modes) | |
386 call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt') | |
387 call assert_equal('c-cv', g:current_modes) | |
388 " How to test Ex mode? | |
389 | |
390 bwipe! | |
391 iunmap <F2> | |
392 endfunc |