comparison src/option.c @ 11764:b82dad3fa176 v8.0.0764

patch 8.0.0764: 'termkey' does not work yet commit https://github.com/vim/vim/commit/dbe948d6c350feacc01ad019b57717149c8ea5e5 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 23 22:50:51 2017 +0200 patch 8.0.0764: 'termkey' does not work yet Problem: 'termkey' does not work yet. Solution: Implement 'termkey'.
author Christian Brabandt <cb@256bit.org>
date Sun, 23 Jul 2017 23:00:04 +0200
parents 74abb6c84984
children 6315c631dcb7
comparison
equal deleted inserted replaced
11763:21f3930dfe6e 11764:b82dad3fa176
3267 static void set_option_default(int, int opt_flags, int compatible); 3267 static void set_option_default(int, int opt_flags, int compatible);
3268 static void set_options_default(int opt_flags); 3268 static void set_options_default(int opt_flags);
3269 static char_u *term_bg_default(void); 3269 static char_u *term_bg_default(void);
3270 static void did_set_option(int opt_idx, int opt_flags, int new_value); 3270 static void did_set_option(int opt_idx, int opt_flags, int new_value);
3271 static char_u *illegal_char(char_u *, int); 3271 static char_u *illegal_char(char_u *, int);
3272 static int string_to_key(char_u *arg);
3273 #ifdef FEAT_CMDWIN 3272 #ifdef FEAT_CMDWIN
3274 static char_u *check_cedit(void); 3273 static char_u *check_cedit(void);
3275 #endif 3274 #endif
3276 #ifdef FEAT_TITLE 3275 #ifdef FEAT_TITLE
3277 static void did_set_title(int icon); 3276 static void did_set_title(int icon);
4761 || *arg == '^' 4760 || *arg == '^'
4762 || (*arg != NUL 4761 || (*arg != NUL
4763 && (!arg[1] || VIM_ISWHITE(arg[1])) 4762 && (!arg[1] || VIM_ISWHITE(arg[1]))
4764 && !VIM_ISDIGIT(*arg)))) 4763 && !VIM_ISDIGIT(*arg))))
4765 { 4764 {
4766 value = string_to_key(arg); 4765 value = string_to_key(arg, FALSE);
4767 if (value == 0 && (long *)varp != &p_wcm) 4766 if (value == 0 && (long *)varp != &p_wcm)
4768 { 4767 {
4769 errmsg = e_invarg; 4768 errmsg = e_invarg;
4770 goto skip; 4769 goto skip;
4771 } 4770 }
5318 } 5317 }
5319 5318
5320 /* 5319 /*
5321 * Convert a key name or string into a key value. 5320 * Convert a key name or string into a key value.
5322 * Used for 'wildchar' and 'cedit' options. 5321 * Used for 'wildchar' and 'cedit' options.
5322 * When "multi_byte" is TRUE allow for multi-byte characters.
5323 */ 5323 */
5324 static int 5324 int
5325 string_to_key(char_u *arg) 5325 string_to_key(char_u *arg, int multi_byte)
5326 { 5326 {
5327 if (*arg == '<') 5327 if (*arg == '<')
5328 return find_key_option(arg + 1); 5328 return find_key_option(arg + 1);
5329 if (*arg == '^') 5329 if (*arg == '^')
5330 return Ctrl_chr(arg[1]); 5330 return Ctrl_chr(arg[1]);
5331 if (multi_byte)
5332 return PTR2CHAR(arg);
5331 return *arg; 5333 return *arg;
5332 } 5334 }
5333 5335
5334 #ifdef FEAT_CMDWIN 5336 #ifdef FEAT_CMDWIN
5335 /* 5337 /*
5343 5345
5344 if (*p_cedit == NUL) 5346 if (*p_cedit == NUL)
5345 cedit_key = -1; 5347 cedit_key = -1;
5346 else 5348 else
5347 { 5349 {
5348 n = string_to_key(p_cedit); 5350 n = string_to_key(p_cedit, FALSE);
5349 if (vim_isprintc(n)) 5351 if (vim_isprintc(n))
5350 return e_invarg; 5352 return e_invarg;
5351 cedit_key = n; 5353 cedit_key = n;
5352 } 5354 }
5353 return NULL; 5355 return NULL;
7460 errmsg = e_invarg; 7462 errmsg = e_invarg;
7461 } 7463 }
7462 #endif 7464 #endif
7463 7465
7464 #ifdef FEAT_TERMINAL 7466 #ifdef FEAT_TERMINAL
7467 /* 'termkey' */
7468 else if (varp == &curwin->w_p_tms)
7469 {
7470 if (*curwin->w_p_tk != NUL && string_to_key(curwin->w_p_tk, TRUE) == 0)
7471 errmsg = e_invarg;
7472 }
7465 /* 'termsize' */ 7473 /* 'termsize' */
7466 else if (varp == &curwin->w_p_tms) 7474 else if (varp == &curwin->w_p_tms)
7467 { 7475 {
7468 if (*curwin->w_p_tms != NUL) 7476 if (*curwin->w_p_tms != NUL)
7469 { 7477 {