aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-07-08 17:33:43 +0200
committerGitHub <noreply@github.com>2017-07-08 17:33:43 +0200
commit0fb4d173f8faa7ec4736ceb3b4e89ada6f7d73e5 (patch)
tree93bb22888e979af1e86dba6c419a441f44e67f42 /src/nvim/api
parent6720fe253e92b21c7f989389a64e363b5933884f (diff)
parent829e1f2c43f84caa74c68e8a473d5faf8ec96c48 (diff)
downloadrneovim-0fb4d173f8faa7ec4736ceb3b4e89ada6f7d73e5.tar.gz
rneovim-0fb4d173f8faa7ec4736ceb3b4e89ada6f7d73e5.tar.bz2
rneovim-0fb4d173f8faa7ec4736ceb3b4e89ada6f7d73e5.zip
Merge #6945 from justinmk/cpoptions
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/vim.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 80efe86ea3..2bc31b2812 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>. Ignored 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,12 +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_KEYCODE set - keycodes are *not* reverse-engineered
- // 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);