aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2014-07-13 11:10:27 +0400
committerZyX <kp-pav@yandex.ru>2016-04-18 02:43:43 +0300
commitebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3 (patch)
tree0bae55f8b469efbef6df94dd16394ea334b22a55 /src/nvim/option.c
parent83c683f5e15867c2e2889442860e91fd1074b4e1 (diff)
downloadrneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.tar.gz
rneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.tar.bz2
rneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.zip
keymap: Make replace_termcodes and friends accept length and cpo_flags
Reasons: - One does not have to do `s[len] = NUL` to work with these functions if they do not need to replace the whole string: thus `s` may be const. - One does not have to save/restore p_cpo to work with them.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 5efd71444a..9942d154e1 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2964,7 +2964,8 @@ did_set_string_option (
/* 'pastetoggle': translate key codes like in a mapping */
else if (varp == &p_pt) {
if (*p_pt) {
- (void)replace_termcodes(p_pt, &p, TRUE, TRUE, FALSE);
+ (void)replace_termcodes(p_pt, STRLEN(p_pt), &p, true, true, false,
+ CPO_TO_CPO_FLAGS);
if (p != NULL) {
if (new_value_alloced)
free_string_option(p_pt);
@@ -4656,7 +4657,7 @@ char_u *get_highlight_default(void)
/*
* Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
*/
-static int find_key_option(char_u *arg)
+static int find_key_option(const char_u *arg)
{
int key;
int modifiers;
@@ -4670,9 +4671,10 @@ static int find_key_option(char_u *arg)
else {
--arg; /* put arg at the '<' */
modifiers = 0;
- key = find_special_key(&arg, &modifiers, TRUE, TRUE);
- if (modifiers) /* can't handle modifiers here */
+ key = find_special_key(&arg, STRLEN(arg), &modifiers, true, true);
+ if (modifiers) { // can't handle modifiers here
key = 0;
+ }
}
return key;
}