comparison src/testdir/test_cmdline.vim @ 18924:a18d7782b80f v8.2.0023

patch 8.2.0023: command line editing not sufficiently tested Commit: https://github.com/vim/vim/commit/59cb041d0a56d8555857da7e063ec61504ee1fa7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 18 22:26:31 2019 +0100 patch 8.2.0023: command line editing not sufficiently tested Problem: Command line editing not sufficiently tested. Solution: Add more tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/5374)
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Dec 2019 22:30:03 +0100
parents 2d41b63f52de
children 5bef1043abff
comparison
equal deleted inserted replaced
18923:70df9116845e 18924:a18d7782b80f
417 call assert_equal('find a/b/fileXname', getreg(':')) 417 call assert_equal('find a/b/fileXname', getreg(':'))
418 bwipe! 418 bwipe!
419 call delete('a', 'rf') 419 call delete('a', 'rf')
420 endfunc 420 endfunc
421 421
422 func Test_paste_in_cmdline() 422 func Test_cmdline_paste()
423 let @a = "def" 423 let @a = "def"
424 call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx') 424 call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx')
425 call assert_equal('"abc def ghi', @:) 425 call assert_equal('"abc def ghi', @:)
426 426
427 new 427 new
457 endtry 457 endtry
458 call assert_equal("Xtestfile", bufname("%")) 458 call assert_equal("Xtestfile", bufname("%"))
459 bwipe! 459 bwipe!
460 endfunc 460 endfunc
461 461
462 func Test_remove_char_in_cmdline() 462 func Test_cmdline_remove_char()
463 call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx') 463 let encoding_save = &encoding
464 call assert_equal('"abc ef', @:) 464
465 465 for e in ['utf8', 'latin1']
466 call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx') 466 exe 'set encoding=' . e
467 call assert_equal('"abcdef', @:) 467
468 468 call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx')
469 call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx') 469 call assert_equal('"abc ef', @:, e)
470 call assert_equal('"abc ghi', @:) 470
471 471 call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx')
472 call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx') 472 call assert_equal('"abcdef', @:)
473 call assert_equal('"def', @:) 473
474 call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx')
475 call assert_equal('"abc ghi', @:, e)
476
477 call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
478 call assert_equal('"def', @:, e)
479 endfor
480
481 let &encoding = encoding_save
482 endfunc
483
484 func Test_cmdline_keymap_ctrl_hat()
485 if !has('keymap')
486 return
487 endif
488
489 set keymap=esperanto
490 call feedkeys(":\"Jxauxdo \<C-^>Jxauxdo \<C-^>Jxauxdo\<CR>", 'tx')
491 call assert_equal('"Jxauxdo Ĵaŭdo Jxauxdo', @:)
492 set keymap=
474 endfunc 493 endfunc
475 494
476 func Test_illegal_address1() 495 func Test_illegal_address1()
477 new 496 new
478 2;'( 497 2;'(
739 for e in encodings 758 for e in encodings
740 exe 'set encoding=' . e 759 exe 'set encoding=' . e
741 760
742 " Test overstrike in the middle of the command line. 761 " Test overstrike in the middle of the command line.
743 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt') 762 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
744 call assert_equal('"0ab1cd4', @:) 763 call assert_equal('"0ab1cd4', @:, e)
745 764
746 " Test overstrike going beyond end of command line. 765 " Test overstrike going beyond end of command line.
747 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cdefgh\<enter>", 'xt') 766 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cdefgh\<enter>", 'xt')
748 call assert_equal('"0ab1cdefgh', @:) 767 call assert_equal('"0ab1cdefgh', @:, e)
749 768
750 " Test toggling insert/overstrike a few times. 769 " Test toggling insert/overstrike a few times.
751 call feedkeys(":\"01234\<home>\<right>ab\<right>\<insert>cd\<right>\<insert>ef\<enter>", 'xt') 770 call feedkeys(":\"01234\<home>\<right>ab\<right>\<insert>cd\<right>\<insert>ef\<enter>", 'xt')
752 call assert_equal('"ab0cd3ef4', @:) 771 call assert_equal('"ab0cd3ef4', @:, e)
753 endfor 772 endfor
754 773
755 " Test overstrike with multi-byte characters. 774 " Test overstrike with multi-byte characters.
756 call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt') 775 call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
757 call assert_equal('"テabキcdエディタ', @:) 776 call assert_equal('"テabキcdエディタ', @:, e)
758 777
759 let &encoding = encoding_save 778 let &encoding = encoding_save
760 endfunc 779 endfunc
761 780
762 func Test_cmdwin_bug() 781 func Test_cmdwin_bug()