From dde4f09f51ffaf8df5cc2a81eed935e31e1f94ba Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 31 Mar 2022 15:47:53 +0800 Subject: vim-patch:8.1.2145: cannot map when modifyOtherKeys is enabled Problem: Cannot map when modifyOtherKeys is enabled. Solution: Add the mapping twice, both with modifier and as 0x08. Use only the first one when modifyOtherKeys has been detected. https://github.com/vim/vim/commit/459fd785e4a8d044147a3f83a5fca8748528aa84 Add REPTERM_NO_SPECIAL instead of REPTERM_SPECIAL because the meaning of "special" is different between Vim and Nvim. Omit seenModifyOtherKeys as Nvim supports attaching multiple UIs. Omit tests as they send terminal codes. Keep the behavior of API functions. --- src/nvim/api/vim.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/vim.c') diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 0f9a4a0e0d..2174cd1620 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -403,9 +403,19 @@ String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, Bool return (String) { .data = NULL, .size = 0 }; } + int flags = 0; + if (from_part) { + flags |= REPTERM_FROM_PART; + } + if (do_lt) { + flags |= REPTERM_DO_LT; + } + if (!special) { + flags |= REPTERM_NO_SPECIAL; + } + char *ptr = NULL; - replace_termcodes((char_u *)str.data, str.size, (char_u **)&ptr, - from_part, do_lt, special, CPO_TO_CPO_FLAGS); + replace_termcodes((char_u *)str.data, str.size, (char_u **)&ptr, flags, NULL, CPO_TO_CPO_FLAGS); return cstr_as_string(ptr); } -- cgit