1
0
forked from aniani/vim

patch 9.0.0806: 'langmap' works differently when there are modifiers

Problem:    'langmap' works differently when there are modifiers.
Solution:   Only apply 'langmap' to a character where modifiers have no
            effect. (closes #11395, closes #11404)
This commit is contained in:
zeertzjq
2022-10-20 17:59:38 +01:00
committed by Bram Moolenaar
parent d0fab10ed2
commit 49660f5139
3 changed files with 55 additions and 9 deletions

View File

@@ -49,6 +49,39 @@ func Test_langmap()
call feedkeys(';', 'tx')
call assert_equal(5, col('.'))
set langmap=RL
let g:counter = 0
nnoremap L;L <Cmd>let g:counter += 1<CR>
nnoremap <C-L> <Cmd>throw 'This mapping shoud not be triggered'<CR>
" 'langmap' is applied to keys without modifiers when matching a mapping
call feedkeys('R;R', 'tx')
call assert_equal(1, g:counter)
nunmap L;L
unlet g:counter
delete
call assert_equal('', getline(1))
undo
call assert_equal('Hello World', getline(1))
" 'langmap' does not change Ctrl-R to Ctrl-L for consistency
call feedkeys("\<*C-R>", 'tx')
call assert_equal('', getline(1))
set langmap=6L
undo
setlocal bufhidden=hide
let oldbuf = bufnr()
enew
call assert_notequal(oldbuf, bufnr())
" 'langmap' does not change Ctrl-6 to Ctrl-L for consistency
" Ctrl-6 becomes Ctrl-^ after merging the Ctrl modifier
call feedkeys("\<*C-6>", 'tx')
call assert_equal(oldbuf, bufnr())
setlocal bufhidden&
nunmap <C-L>
set langmap&
quit!
endfunc