vim-patch:8.2.0148: mapping related function in wrong source file

Problem:    Mapping related function in wrong source file.
Solution:   Move the function.  Add a few more test cases. (Yegappan
            Lakshmanan, closes vim/vim#5528)

7f51bbe0d1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-02-17 07:59:22 +08:00
parent df666521ac
commit f6a6db3e24
2 changed files with 38 additions and 3 deletions

View File

@ -26,9 +26,11 @@ if exists('s:did_load')
set viewoptions& set viewoptions&
set viewoptions+=options set viewoptions+=options
set switchbuf= set switchbuf=
if g:testname !~ 'test_mapping.vim$'
" Make "Q" switch to Ex mode. " Make "Q" switch to Ex mode.
" This does not work for all tests. " This does not work for all tests.
nnoremap Q gQ nnoremap Q gQ
endif
endif endif
" Common preparations for running tests. " Common preparations for running tests.

View File

@ -934,6 +934,39 @@ func Test_abbr_remove()
call assert_equal({}, maparg('foo', 'i', 1, 1)) call assert_equal({}, maparg('foo', 'i', 1, 1))
endfunc endfunc
" Trigger an abbreviation using a special key
func Test_abbr_trigger_special()
new
iabbr teh the
call feedkeys("iteh\<F2>\<Esc>", 'xt')
call assert_equal('the<F2>', getline(1))
iunab teh
close!
endfunc
" Test for '<' in 'cpoptions'
func Test_map_cpo_special_keycode()
set cpo-=<
imap x<Bslash>k Test
let d = maparg('x<Bslash>k', 'i', 0, 1)
call assert_equal(['x\k', 'Test', 'i'], [d.lhs, d.rhs, d.mode])
call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"imap x\k', @:)
iunmap x<Bslash>k
" Nvim: no "<" flag in 'cpoptions'.
" set cpo+=<
" imap x<Bslash>k Test
" let d = maparg('x<Bslash>k', 'i', 0, 1)
" call assert_equal(['x<Bslash>k', 'Test', 'i'], [d.lhs, d.rhs, d.mode])
" call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx')
" call assert_equal('"imap x<Bslash>k', @:)
" iunmap x<Bslash>k
set cpo-=<
" Modifying 'cpo' above adds some default mappings, remove them
mapclear
mapclear!
endfunc
func Test_map_cmdkey_redo() func Test_map_cmdkey_redo()
func SelectDash() func SelectDash()
call search('^---\n\zs', 'bcW') call search('^---\n\zs', 'bcW')