mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.1759: no mode char for terminal mapping from maparg()
Problem: No mode char for terminal mapping from maparg().
Solution: Check for TERMINAL mode. (closes vim/vim#4735)
14371ed697
This commit is contained in:
parent
7f5a113f65
commit
08c7e206cc
@ -3304,6 +3304,8 @@ char *map_mode_to_chars(int mode)
|
|||||||
ga_append(&mapmode, 'n'); /* :nmap */
|
ga_append(&mapmode, 'n'); /* :nmap */
|
||||||
if (mode & OP_PENDING)
|
if (mode & OP_PENDING)
|
||||||
ga_append(&mapmode, 'o'); /* :omap */
|
ga_append(&mapmode, 'o'); /* :omap */
|
||||||
|
if (mode & TERM_FOCUS)
|
||||||
|
ga_append(&mapmode, 't'); /* :tmap */
|
||||||
if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
|
if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
|
||||||
ga_append(&mapmode, 'v'); /* :vmap */
|
ga_append(&mapmode, 'v'); /* :vmap */
|
||||||
else {
|
else {
|
||||||
|
@ -27,6 +27,10 @@ function Test_maparg()
|
|||||||
call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ',
|
call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'foo', 'mode': ' ',
|
||||||
\ 'nowait': 1, 'expr': 0, 'sid': sid, 'rhs': 'bar', 'buffer': 1},
|
\ 'nowait': 1, 'expr': 0, 'sid': sid, 'rhs': 'bar', 'buffer': 1},
|
||||||
\ maparg('foo', '', 0, 1))
|
\ maparg('foo', '', 0, 1))
|
||||||
|
tmap baz foo
|
||||||
|
call assert_equal({'silent': 0, 'noremap': 0, 'lhs': 'baz', 'mode': 't',
|
||||||
|
\ 'nowait': 0, 'expr': 0, 'sid': sid, 'rhs': 'foo', 'buffer': 0},
|
||||||
|
\ maparg('baz', 't', 0, 1))
|
||||||
|
|
||||||
map abc x<char-114>x
|
map abc x<char-114>x
|
||||||
call assert_equal("xrx", maparg('abc'))
|
call assert_equal("xrx", maparg('abc'))
|
||||||
|
@ -346,11 +346,6 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
|||||||
to_return.sid = not opts.sid and 0 or opts.sid
|
to_return.sid = not opts.sid and 0 or opts.sid
|
||||||
to_return.buffer = not opts.buffer and 0 or opts.buffer
|
to_return.buffer = not opts.buffer and 0 or opts.buffer
|
||||||
|
|
||||||
-- mode 't' doesn't print when calling maparg
|
|
||||||
if mode == 't' then
|
|
||||||
to_return.mode = ''
|
|
||||||
end
|
|
||||||
|
|
||||||
return to_return
|
return to_return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user