aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-07-02 13:21:38 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-07-08 16:34:35 +0200
commit0ea7e45bc1d1881f505da2b77e0b3e4eb56f12fe (patch)
tree4248c49bec3924a7faa974535aa7de2df0d7d88b /src/nvim/api/vim.c
parent78c5201234e478ff8f648adea95be18ca588a9cd (diff)
downloadrneovim-0ea7e45bc1d1881f505da2b77e0b3e4eb56f12fe.tar.gz
rneovim-0ea7e45bc1d1881f505da2b77e0b3e4eb56f12fe.tar.bz2
rneovim-0ea7e45bc1d1881f505da2b77e0b3e4eb56f12fe.zip
'cpoptions': remove "<" flag; ignore <special>
Closes #6937 "nvim_get_keymap output is unreliable"
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index ac7c9cbce6..8ab0c0ebda 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -136,9 +136,13 @@ Integer nvim_input(String keys)
return (Integer)input_enqueue(keys);
}
-/// Replaces terminal codes and key codes (<CR>, <Esc>, ...) in a string with
+/// Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a string with
/// the internal representation.
///
+/// @param str String to be converted.
+/// @param from_part Legacy Vim parameter. Usually true.
+/// @param do_lt Also translate <lt>. Does nothing if `special` is false.
+/// @param special Replace |keycodes|, e.g. <CR> becomes a "\n" char.
/// @see replace_termcodes
/// @see cpoptions
String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
@@ -151,11 +155,6 @@ String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
}
char *ptr = NULL;
- // Set 'cpoptions' the way we want it.
- // FLAG_CPO_BSLASH set - backslashes are *not* treated specially
- // FLAG_CPO_SPECI unset - <Key> sequences *are* interpreted
- // The third from end parameter of replace_termcodes() is true so that the
- // <lt> sequence is recognised - needed for a real backslash.
replace_termcodes((char_u *)str.data, str.size, (char_u **)&ptr,
from_part, do_lt, special, CPO_TO_CPO_FLAGS);
return cstr_as_string(ptr);