diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-01 14:00:57 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-01 21:54:18 +0800 |
commit | 5c72640bc2b60a018ccfcf18bca809b635f250f6 (patch) | |
tree | 601788dea1971825cd327d97248a58709a5bc71b /src/nvim/mapping.c | |
parent | 083865071b52d746de50294a0603bc6dbe20b3ec (diff) | |
download | rneovim-5c72640bc2b60a018ccfcf18bca809b635f250f6.tar.gz rneovim-5c72640bc2b60a018ccfcf18bca809b635f250f6.tar.bz2 rneovim-5c72640bc2b60a018ccfcf18bca809b635f250f6.zip |
vim-patch:8.2.0812: mapset() does not properly handle <> notation
Problem: mapset() does not properly handle <> notation.
Solution: Convert <> codes. (closes vim/vim#6116)
https://github.com/vim/vim/commit/c94c1467b9b86156a6b7c8d3e41ff01c13d2be07
Diffstat (limited to 'src/nvim/mapping.c')
-rw-r--r-- | src/nvim/mapping.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 384497174d..3613849a73 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -2150,6 +2150,9 @@ void f_mapset(typval_T *argvars, typval_T *rettv, FunPtr fptr) emsg(_("E99: rhs entry missing in mapset() dict argument")); return; } + char *orig_rhs = rhs; + char *arg_buf = NULL; + rhs = replace_termcodes(rhs, STRLEN(rhs), &arg_buf, REPTERM_DO_LT, NULL, CPO_TO_CPO_FLAGS); int noremap = tv_dict_get_number(d, "noremap") ? REMAP_NONE : 0; if (tv_dict_get_number(d, "script") != 0) { @@ -2158,9 +2161,9 @@ void f_mapset(typval_T *argvars, typval_T *rettv, FunPtr fptr) // TODO: support "callback" and "desc" MapArguments args = { - .rhs = vim_strsave((char_u *)rhs), + .rhs = (char_u *)rhs, .rhs_lua = LUA_NOREF, - .orig_rhs = vim_strsave((char_u *)rhs), + .orig_rhs = vim_strsave((char_u *)orig_rhs), .expr = tv_dict_get_number(d, "expr") != 0, .silent = tv_dict_get_number(d, "silent") != 0, .nowait = tv_dict_get_number(d, "nowait") != 0, |