Mercurial > vim
comparison src/option.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 6ab9c18708c4 |
children | 0fcc1315c061 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
3293 static long_u *insecure_flag(int opt_idx, int opt_flags); | 3293 static long_u *insecure_flag(int opt_idx, int opt_flags); |
3294 #else | 3294 #else |
3295 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) | 3295 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) |
3296 #endif | 3296 #endif |
3297 static void set_string_option_global(int opt_idx, char_u **varp); | 3297 static void set_string_option_global(int opt_idx, char_u **varp); |
3298 static char_u *did_set_string_option(int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags, int *value_checked); | 3298 static char *did_set_string_option(int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char *errbuf, int opt_flags, int *value_checked); |
3299 static char_u *set_chars_option(char_u **varp); | 3299 static char *set_chars_option(char_u **varp); |
3300 #ifdef FEAT_CLIPBOARD | 3300 #ifdef FEAT_CLIPBOARD |
3301 static char_u *check_clipboard_option(void); | 3301 static char *check_clipboard_option(void); |
3302 #endif | 3302 #endif |
3303 #ifdef FEAT_SPELL | 3303 #ifdef FEAT_SPELL |
3304 static char_u *did_set_spell_option(int is_spellfile); | 3304 static char *did_set_spell_option(int is_spellfile); |
3305 static char_u *compile_cap_prog(synblock_T *synblock); | 3305 static char *compile_cap_prog(synblock_T *synblock); |
3306 #endif | 3306 #endif |
3307 #ifdef FEAT_EVAL | 3307 #ifdef FEAT_EVAL |
3308 static void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx); | 3308 static void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx); |
3309 #endif | 3309 #endif |
3310 static char_u *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags); | 3310 static char *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags); |
3311 static char_u *set_num_option(int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen, int opt_flags); | 3311 static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, int opt_flags); |
3312 static void check_redraw(long_u flags); | 3312 static void check_redraw(long_u flags); |
3313 static int findoption(char_u *); | 3313 static int findoption(char_u *); |
3314 static int find_key_option(char_u *arg_arg, int has_lt); | 3314 static int find_key_option(char_u *arg_arg, int has_lt); |
3315 static void showoptions(int all, int opt_flags); | 3315 static void showoptions(int all, int opt_flags); |
3316 static int optval_default(struct vimoption *, char_u *varp); | 3316 static int optval_default(struct vimoption *, char_u *varp); |
3706 options[opt_idx].def_val[VI_DEFAULT] = p_enc; | 3706 options[opt_idx].def_val[VI_DEFAULT] = p_enc; |
3707 options[opt_idx].flags |= P_DEF_ALLOCED; | 3707 options[opt_idx].flags |= P_DEF_ALLOCED; |
3708 } | 3708 } |
3709 | 3709 |
3710 #if defined(MSWIN) || defined(MACOS_X) || defined(VMS) | 3710 #if defined(MSWIN) || defined(MACOS_X) || defined(VMS) |
3711 if (STRCMP(p_enc, "latin1") == 0 | 3711 if (STRCMP(p_enc, "latin1") == 0 || enc_utf8) |
3712 # ifdef FEAT_MBYTE | |
3713 || enc_utf8 | |
3714 # endif | |
3715 ) | |
3716 { | 3712 { |
3717 /* Adjust the default for 'isprint' and 'iskeyword' to match | 3713 /* Adjust the default for 'isprint' and 'iskeyword' to match |
3718 * latin1. Also set the defaults for when 'nocompatible' is | 3714 * latin1. Also set the defaults for when 'nocompatible' is |
3719 * set. */ | 3715 * set. */ |
3720 set_string_option_direct((char_u *)"isp", -1, | 3716 set_string_option_direct((char_u *)"isp", -1, |
4391 do_set( | 4387 do_set( |
4392 char_u *arg, /* option string (may be written to!) */ | 4388 char_u *arg, /* option string (may be written to!) */ |
4393 int opt_flags) | 4389 int opt_flags) |
4394 { | 4390 { |
4395 int opt_idx; | 4391 int opt_idx; |
4396 char_u *errmsg; | 4392 char *errmsg; |
4397 char_u errbuf[80]; | 4393 char errbuf[80]; |
4398 char_u *startarg; | 4394 char_u *startarg; |
4399 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */ | 4395 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */ |
4400 int nextchar; /* next non-white char after option name */ | 4396 int nextchar; /* next non-white char after option name */ |
4401 int afterchar; /* character just after option name */ | 4397 int afterchar; /* character just after option name */ |
4402 int len; | 4398 int len; |
4544 } | 4540 } |
4545 nextchar = arg[len]; | 4541 nextchar = arg[len]; |
4546 | 4542 |
4547 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */ | 4543 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */ |
4548 { | 4544 { |
4549 errmsg = (char_u *)N_("E518: Unknown option"); | 4545 errmsg = N_("E518: Unknown option"); |
4550 goto skip; | 4546 goto skip; |
4551 } | 4547 } |
4552 | 4548 |
4553 if (opt_idx >= 0) | 4549 if (opt_idx >= 0) |
4554 { | 4550 { |
4557 /* Only give an error message when requesting the value of | 4553 /* Only give an error message when requesting the value of |
4558 * a hidden option, ignore setting it. */ | 4554 * a hidden option, ignore setting it. */ |
4559 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL | 4555 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL |
4560 && (!(options[opt_idx].flags & P_BOOL) | 4556 && (!(options[opt_idx].flags & P_BOOL) |
4561 || nextchar == '?')) | 4557 || nextchar == '?')) |
4562 errmsg = (char_u *)N_("E519: Option not supported"); | 4558 errmsg = N_("E519: Option not supported"); |
4563 goto skip; | 4559 goto skip; |
4564 } | 4560 } |
4565 | 4561 |
4566 flags = options[opt_idx].flags; | 4562 flags = options[opt_idx].flags; |
4567 varp = get_varp_scope(&(options[opt_idx]), opt_flags); | 4563 varp = get_varp_scope(&(options[opt_idx]), opt_flags); |
4595 /* Disallow changing some options from modelines. */ | 4591 /* Disallow changing some options from modelines. */ |
4596 if (opt_flags & OPT_MODELINE) | 4592 if (opt_flags & OPT_MODELINE) |
4597 { | 4593 { |
4598 if (flags & (P_SECURE | P_NO_ML)) | 4594 if (flags & (P_SECURE | P_NO_ML)) |
4599 { | 4595 { |
4600 errmsg = (char_u *)_("E520: Not allowed in a modeline"); | 4596 errmsg = _("E520: Not allowed in a modeline"); |
4601 goto skip; | 4597 goto skip; |
4602 } | 4598 } |
4603 #ifdef FEAT_DIFF | 4599 #ifdef FEAT_DIFF |
4604 /* In diff mode some options are overruled. This avoids that | 4600 /* In diff mode some options are overruled. This avoids that |
4605 * 'foldmethod' becomes "marker" instead of "diff" and that | 4601 * 'foldmethod' becomes "marker" instead of "diff" and that |
4617 | 4613 |
4618 #ifdef HAVE_SANDBOX | 4614 #ifdef HAVE_SANDBOX |
4619 /* Disallow changing some options in the sandbox */ | 4615 /* Disallow changing some options in the sandbox */ |
4620 if (sandbox != 0 && (flags & P_SECURE)) | 4616 if (sandbox != 0 && (flags & P_SECURE)) |
4621 { | 4617 { |
4622 errmsg = (char_u *)_(e_sandbox); | 4618 errmsg = _(e_sandbox); |
4623 goto skip; | 4619 goto skip; |
4624 } | 4620 } |
4625 #endif | 4621 #endif |
4626 | 4622 |
4627 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) | 4623 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) |
4691 char_u *p; | 4687 char_u *p; |
4692 | 4688 |
4693 p = find_termcode(key_name); | 4689 p = find_termcode(key_name); |
4694 if (p == NULL) | 4690 if (p == NULL) |
4695 { | 4691 { |
4696 errmsg = (char_u *)N_("E846: Key code not set"); | 4692 errmsg = N_("E846: Key code not set"); |
4697 goto skip; | 4693 goto skip; |
4698 } | 4694 } |
4699 else | 4695 else |
4700 (void)show_one_termcode(key_name, p, TRUE); | 4696 (void)show_one_termcode(key_name, p, TRUE); |
4701 } | 4697 } |
4820 goto skip; | 4816 goto skip; |
4821 } | 4817 } |
4822 } | 4818 } |
4823 else | 4819 else |
4824 { | 4820 { |
4825 errmsg = (char_u *)N_("E521: Number required after ="); | 4821 errmsg = N_("E521: Number required after ="); |
4826 goto skip; | 4822 goto skip; |
4827 } | 4823 } |
4828 | 4824 |
4829 if (adding) | 4825 if (adding) |
4830 value = *(long *)varp + value; | 4826 value = *(long *)varp + value; |
4921 if (varp == (char_u *)&p_kp | 4917 if (varp == (char_u *)&p_kp |
4922 && (*arg == NUL || *arg == ' ')) | 4918 && (*arg == NUL || *arg == ' ')) |
4923 { | 4919 { |
4924 STRCPY(errbuf, ":help"); | 4920 STRCPY(errbuf, ":help"); |
4925 save_arg = arg; | 4921 save_arg = arg; |
4926 arg = errbuf; | 4922 arg = (char_u *)errbuf; |
4927 } | 4923 } |
4928 /* | 4924 /* |
4929 * Convert 'backspace' number to string, for | 4925 * Convert 'backspace' number to string, for |
4930 * adding, prepending and removing string. | 4926 * adding, prepending and removing string. |
4931 */ | 4927 */ |
4973 if (i & 16) | 4969 if (i & 16) |
4974 STRCAT(errbuf, "[,],"); | 4970 STRCAT(errbuf, "[,],"); |
4975 if (*errbuf != NUL) /* remove trailing , */ | 4971 if (*errbuf != NUL) /* remove trailing , */ |
4976 errbuf[STRLEN(errbuf) - 1] = NUL; | 4972 errbuf[STRLEN(errbuf) - 1] = NUL; |
4977 save_arg = arg; | 4973 save_arg = arg; |
4978 arg = errbuf; | 4974 arg = (char_u *)errbuf; |
4979 } | 4975 } |
4980 /* | 4976 /* |
4981 * Remove '>' before 'dir' and 'bdir', for | 4977 * Remove '>' before 'dir' and 'bdir', for |
4982 * backwards compatibility with version 3.0 | 4978 * backwards compatibility with version 3.0 |
4983 */ | 4979 */ |
5257 char_u *p; | 5253 char_u *p; |
5258 | 5254 |
5259 if (nextchar == '&') | 5255 if (nextchar == '&') |
5260 { | 5256 { |
5261 if (add_termcap_entry(key_name, TRUE) == FAIL) | 5257 if (add_termcap_entry(key_name, TRUE) == FAIL) |
5262 errmsg = (char_u *)N_("E522: Not found in termcap"); | 5258 errmsg = N_("E522: Not found in termcap"); |
5263 } | 5259 } |
5264 else | 5260 else |
5265 { | 5261 { |
5266 ++arg; /* jump to after the '=' or ':' */ | 5262 ++arg; /* jump to after the '=' or ':' */ |
5267 for (p = arg; *p && !VIM_ISWHITE(*p); ++p) | 5263 for (p = arg; *p && !VIM_ISWHITE(*p); ++p) |
5313 IObuff[i + (arg - startarg)] = NUL; | 5309 IObuff[i + (arg - startarg)] = NUL; |
5314 } | 5310 } |
5315 /* make sure all characters are printable */ | 5311 /* make sure all characters are printable */ |
5316 trans_characters(IObuff, IOSIZE); | 5312 trans_characters(IObuff, IOSIZE); |
5317 | 5313 |
5318 ++no_wait_return; /* wait_return done later */ | 5314 ++no_wait_return; // wait_return done later |
5319 emsg(IObuff); /* show error highlighted */ | 5315 emsg((char *)IObuff); // show error highlighted |
5320 --no_wait_return; | 5316 --no_wait_return; |
5321 | 5317 |
5322 return FAIL; | 5318 return FAIL; |
5323 } | 5319 } |
5324 | 5320 |
5369 *p = *p | P_INSECURE; | 5365 *p = *p | P_INSECURE; |
5370 else if (new_value) | 5366 else if (new_value) |
5371 *p = *p & ~P_INSECURE; | 5367 *p = *p & ~P_INSECURE; |
5372 } | 5368 } |
5373 | 5369 |
5374 static char_u * | 5370 static char * |
5375 illegal_char(char_u *errbuf, int c) | 5371 illegal_char(char *errbuf, int c) |
5376 { | 5372 { |
5377 if (errbuf == NULL) | 5373 if (errbuf == NULL) |
5378 return (char_u *)""; | 5374 return ""; |
5379 sprintf((char *)errbuf, _("E539: Illegal character <%s>"), | 5375 sprintf((char *)errbuf, _("E539: Illegal character <%s>"), |
5380 (char *)transchar(c)); | 5376 (char *)transchar(c)); |
5381 return errbuf; | 5377 return errbuf; |
5382 } | 5378 } |
5383 | 5379 |
5401 #ifdef FEAT_CMDWIN | 5397 #ifdef FEAT_CMDWIN |
5402 /* | 5398 /* |
5403 * Check value of 'cedit' and set cedit_key. | 5399 * Check value of 'cedit' and set cedit_key. |
5404 * Returns NULL if value is OK, error message otherwise. | 5400 * Returns NULL if value is OK, error message otherwise. |
5405 */ | 5401 */ |
5406 static char_u * | 5402 static char * |
5407 check_cedit(void) | 5403 check_cedit(void) |
5408 { | 5404 { |
5409 int n; | 5405 int n; |
5410 | 5406 |
5411 if (*p_cedit == NUL) | 5407 if (*p_cedit == NUL) |
5943 if (idx == -1) /* use name */ | 5939 if (idx == -1) /* use name */ |
5944 { | 5940 { |
5945 idx = findoption(name); | 5941 idx = findoption(name); |
5946 if (idx < 0) /* not found (should not happen) */ | 5942 if (idx < 0) /* not found (should not happen) */ |
5947 { | 5943 { |
5948 EMSG2(_(e_intern2), "set_string_option_direct()"); | 5944 semsg(_(e_intern2), "set_string_option_direct()"); |
5949 IEMSG2(_("For option %s"), name); | 5945 siemsg(_("For option %s"), name); |
5950 return; | 5946 return; |
5951 } | 5947 } |
5952 } | 5948 } |
5953 | 5949 |
5954 if (options[idx].var == NULL) /* can't set hidden option */ | 5950 if (options[idx].var == NULL) /* can't set hidden option */ |
6022 /* | 6018 /* |
6023 * Set a string option to a new value, and handle the effects. | 6019 * Set a string option to a new value, and handle the effects. |
6024 * | 6020 * |
6025 * Returns NULL on success or error message on error. | 6021 * Returns NULL on success or error message on error. |
6026 */ | 6022 */ |
6027 static char_u * | 6023 static char * |
6028 set_string_option( | 6024 set_string_option( |
6029 int opt_idx, | 6025 int opt_idx, |
6030 char_u *value, | 6026 char_u *value, |
6031 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ | 6027 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ |
6032 { | 6028 { |
6035 char_u *oldval; | 6031 char_u *oldval; |
6036 #if defined(FEAT_EVAL) | 6032 #if defined(FEAT_EVAL) |
6037 char_u *saved_oldval = NULL; | 6033 char_u *saved_oldval = NULL; |
6038 char_u *saved_newval = NULL; | 6034 char_u *saved_newval = NULL; |
6039 #endif | 6035 #endif |
6040 char_u *r = NULL; | 6036 char *r = NULL; |
6041 int value_checked = FALSE; | 6037 int value_checked = FALSE; |
6042 | 6038 |
6043 if (options[opt_idx].var == NULL) /* don't set hidden option */ | 6039 if (options[opt_idx].var == NULL) /* don't set hidden option */ |
6044 return NULL; | 6040 return NULL; |
6045 | 6041 |
6098 | 6094 |
6099 /* | 6095 /* |
6100 * Handle string options that need some action to perform when changed. | 6096 * Handle string options that need some action to perform when changed. |
6101 * Returns NULL for success, or an error message for an error. | 6097 * Returns NULL for success, or an error message for an error. |
6102 */ | 6098 */ |
6103 static char_u * | 6099 static char * |
6104 did_set_string_option( | 6100 did_set_string_option( |
6105 int opt_idx, // index in options[] table | 6101 int opt_idx, // index in options[] table |
6106 char_u **varp, // pointer to the option variable | 6102 char_u **varp, // pointer to the option variable |
6107 int new_value_alloced, // new value was allocated | 6103 int new_value_alloced, // new value was allocated |
6108 char_u *oldval, // previous value of the option | 6104 char_u *oldval, // previous value of the option |
6109 char_u *errbuf, // buffer for errors, or NULL | 6105 char *errbuf, // buffer for errors, or NULL |
6110 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL | 6106 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL |
6111 int *value_checked) // value was checked to be save, no | 6107 int *value_checked) // value was checked to be save, no |
6112 // need to set P_INSECURE | 6108 // need to set P_INSECURE |
6113 { | 6109 { |
6114 char_u *errmsg = NULL; | 6110 char *errmsg = NULL; |
6115 char_u *s, *p; | 6111 char_u *s, *p; |
6116 int did_chartab = FALSE; | 6112 int did_chartab = FALSE; |
6117 char_u **gvarp; | 6113 char_u **gvarp; |
6118 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED); | 6114 long_u free_oldval = (options[opt_idx].flags & P_ALLOCED); |
6119 #ifdef FEAT_GUI | 6115 #ifdef FEAT_GUI |
6153 | 6149 |
6154 /* 'term' */ | 6150 /* 'term' */ |
6155 else if (varp == &T_NAME) | 6151 else if (varp == &T_NAME) |
6156 { | 6152 { |
6157 if (T_NAME[0] == NUL) | 6153 if (T_NAME[0] == NUL) |
6158 errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string"); | 6154 errmsg = N_("E529: Cannot set 'term' to empty string"); |
6159 #ifdef FEAT_GUI | 6155 #ifdef FEAT_GUI |
6160 if (gui.in_use) | 6156 if (gui.in_use) |
6161 errmsg = (char_u *)N_("E530: Cannot change term in GUI"); | 6157 errmsg = N_("E530: Cannot change term in GUI"); |
6162 else if (term_is_gui(T_NAME)) | 6158 else if (term_is_gui(T_NAME)) |
6163 errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI"); | 6159 errmsg = N_("E531: Use \":gui\" to start the GUI"); |
6164 #endif | 6160 #endif |
6165 else if (set_termname(T_NAME) == FAIL) | 6161 else if (set_termname(T_NAME) == FAIL) |
6166 errmsg = (char_u *)N_("E522: Not found in termcap"); | 6162 errmsg = N_("E522: Not found in termcap"); |
6167 else | 6163 else |
6168 { | 6164 { |
6169 /* Screen colors may have changed. */ | 6165 /* Screen colors may have changed. */ |
6170 redraw_later_clear(); | 6166 redraw_later_clear(); |
6171 | 6167 |
6209 /* 'backupext' and 'patchmode' */ | 6205 /* 'backupext' and 'patchmode' */ |
6210 else if (varp == &p_bex || varp == &p_pm) | 6206 else if (varp == &p_bex || varp == &p_pm) |
6211 { | 6207 { |
6212 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, | 6208 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, |
6213 *p_pm == '.' ? p_pm + 1 : p_pm) == 0) | 6209 *p_pm == '.' ? p_pm + 1 : p_pm) == 0) |
6214 errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal"); | 6210 errmsg = N_("E589: 'backupext' and 'patchmode' are equal"); |
6215 } | 6211 } |
6216 #ifdef FEAT_LINEBREAK | 6212 #ifdef FEAT_LINEBREAK |
6217 /* 'breakindentopt' */ | 6213 /* 'breakindentopt' */ |
6218 else if (varp == &curwin->w_p_briopt) | 6214 else if (varp == &curwin->w_p_briopt) |
6219 { | 6215 { |
6326 else if (varp == &p_ambw || varp == &p_emoji) | 6322 else if (varp == &p_ambw || varp == &p_emoji) |
6327 { | 6323 { |
6328 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) | 6324 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) |
6329 errmsg = e_invarg; | 6325 errmsg = e_invarg; |
6330 else if (set_chars_option(&p_lcs) != NULL) | 6326 else if (set_chars_option(&p_lcs) != NULL) |
6331 errmsg = (char_u *)_("E834: Conflicts with value of 'listchars'"); | 6327 errmsg = _("E834: Conflicts with value of 'listchars'"); |
6332 else if (set_chars_option(&p_fcs) != NULL) | 6328 else if (set_chars_option(&p_fcs) != NULL) |
6333 errmsg = (char_u *)_("E835: Conflicts with value of 'fillchars'"); | 6329 errmsg = _("E835: Conflicts with value of 'fillchars'"); |
6334 } | 6330 } |
6335 #endif | 6331 #endif |
6336 | 6332 |
6337 /* 'background' */ | 6333 /* 'background' */ |
6338 else if (varp == &p_bg) | 6334 else if (varp == &p_bg) |
6452 # if defined(FEAT_GUI_GTK) | 6448 # if defined(FEAT_GUI_GTK) |
6453 if (errmsg == NULL && varp == &p_tenc && gui.in_use) | 6449 if (errmsg == NULL && varp == &p_tenc && gui.in_use) |
6454 { | 6450 { |
6455 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */ | 6451 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */ |
6456 if (STRCMP(p_tenc, "utf-8") != 0) | 6452 if (STRCMP(p_tenc, "utf-8") != 0) |
6457 errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI"); | 6453 errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI"); |
6458 } | 6454 } |
6459 # endif | 6455 # endif |
6460 | 6456 |
6461 if (errmsg == NULL) | 6457 if (errmsg == NULL) |
6462 { | 6458 { |
6473 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) | 6469 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) |
6474 { | 6470 { |
6475 if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL | 6471 if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL |
6476 || convert_setup(&output_conv, p_enc, p_tenc) == FAIL) | 6472 || convert_setup(&output_conv, p_enc, p_tenc) == FAIL) |
6477 { | 6473 { |
6478 EMSG3(_("E950: Cannot convert between %s and %s"), | 6474 semsg(_("E950: Cannot convert between %s and %s"), |
6479 p_tenc, p_enc); | 6475 p_tenc, p_enc); |
6480 errmsg = e_invarg; | 6476 errmsg = e_invarg; |
6481 } | 6477 } |
6482 } | 6478 } |
6483 | 6479 |
6746 break; | 6742 break; |
6747 } | 6743 } |
6748 ++s; | 6744 ++s; |
6749 } | 6745 } |
6750 if (*s++ == NUL) | 6746 if (*s++ == NUL) |
6751 errmsg = (char_u *)N_("E524: Missing colon"); | 6747 errmsg = N_("E524: Missing colon"); |
6752 else if (*s == ',' || *s == NUL) | 6748 else if (*s == ',' || *s == NUL) |
6753 errmsg = (char_u *)N_("E525: Zero length string"); | 6749 errmsg = N_("E525: Zero length string"); |
6754 if (errmsg != NULL) | 6750 if (errmsg != NULL) |
6755 break; | 6751 break; |
6756 while (*s && *s != ',') | 6752 while (*s && *s != ',') |
6757 { | 6753 { |
6758 if (*s == '\\' && s[1] != NUL) | 6754 if (*s == '\\' && s[1] != NUL) |
6828 | 6824 |
6829 if (!VIM_ISDIGIT(*(s - 1))) | 6825 if (!VIM_ISDIGIT(*(s - 1))) |
6830 { | 6826 { |
6831 if (errbuf != NULL) | 6827 if (errbuf != NULL) |
6832 { | 6828 { |
6833 sprintf((char *)errbuf, | 6829 sprintf(errbuf, _("E526: Missing number after <%s>"), |
6834 _("E526: Missing number after <%s>"), | |
6835 transchar_byte(*(s - 1))); | 6830 transchar_byte(*(s - 1))); |
6836 errmsg = errbuf; | 6831 errmsg = errbuf; |
6837 } | 6832 } |
6838 else | 6833 else |
6839 errmsg = (char_u *)""; | 6834 errmsg = ""; |
6840 break; | 6835 break; |
6841 } | 6836 } |
6842 } | 6837 } |
6843 if (*s == ',') | 6838 if (*s == ',') |
6844 ++s; | 6839 ++s; |
6845 else if (*s) | 6840 else if (*s) |
6846 { | 6841 { |
6847 if (errbuf != NULL) | 6842 if (errbuf != NULL) |
6848 errmsg = (char_u *)N_("E527: Missing comma"); | 6843 errmsg = N_("E527: Missing comma"); |
6849 else | 6844 else |
6850 errmsg = (char_u *)""; | 6845 errmsg = ""; |
6851 break; | 6846 break; |
6852 } | 6847 } |
6853 } | 6848 } |
6854 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0) | 6849 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0) |
6855 errmsg = (char_u *)N_("E528: Must specify a ' value"); | 6850 errmsg = N_("E528: Must specify a ' value"); |
6856 } | 6851 } |
6857 #endif /* FEAT_VIMINFO */ | 6852 #endif /* FEAT_VIMINFO */ |
6858 | 6853 |
6859 /* terminal options */ | 6854 /* terminal options */ |
6860 else if (istermoption(&options[opt_idx]) && full_screen) | 6855 else if (istermoption(&options[opt_idx]) && full_screen) |
6915 else if (varp == &p_sbr) | 6910 else if (varp == &p_sbr) |
6916 { | 6911 { |
6917 for (s = p_sbr; *s; ) | 6912 for (s = p_sbr; *s; ) |
6918 { | 6913 { |
6919 if (ptr2cells(s) != 1) | 6914 if (ptr2cells(s) != 1) |
6920 errmsg = (char_u *)N_("E595: contains unprintable or wide character"); | 6915 errmsg = N_("E595: contains unprintable or wide character"); |
6921 MB_PTR_ADV(s); | 6916 MB_PTR_ADV(s); |
6922 } | 6917 } |
6923 } | 6918 } |
6924 #endif | 6919 #endif |
6925 | 6920 |
6959 p_guifont = vim_strsave(oldval); | 6954 p_guifont = vim_strsave(oldval); |
6960 new_value_alloced = TRUE; | 6955 new_value_alloced = TRUE; |
6961 } | 6956 } |
6962 else | 6957 else |
6963 # endif | 6958 # endif |
6964 errmsg = (char_u *)N_("E596: Invalid font(s)"); | 6959 errmsg = N_("E596: Invalid font(s)"); |
6965 } | 6960 } |
6966 } | 6961 } |
6967 redraw_gui_only = TRUE; | 6962 redraw_gui_only = TRUE; |
6968 } | 6963 } |
6969 # ifdef FEAT_XFONTSET | 6964 # ifdef FEAT_XFONTSET |
6978 # endif | 6973 # endif |
6979 # ifdef FEAT_MBYTE | 6974 # ifdef FEAT_MBYTE |
6980 else if (varp == &p_guifontwide) | 6975 else if (varp == &p_guifontwide) |
6981 { | 6976 { |
6982 if (STRCMP(p_guifontwide, "*") == 0) | 6977 if (STRCMP(p_guifontwide, "*") == 0) |
6983 errmsg = (char_u *)N_("E533: can't select wide font"); | 6978 errmsg = N_("E533: can't select wide font"); |
6984 else if (gui_get_wide_font() == FAIL) | 6979 else if (gui_get_wide_font() == FAIL) |
6985 errmsg = (char_u *)N_("E534: Invalid wide font"); | 6980 errmsg = N_("E534: Invalid wide font"); |
6986 redraw_gui_only = TRUE; | 6981 redraw_gui_only = TRUE; |
6987 } | 6982 } |
6988 # endif | 6983 # endif |
6989 #endif | 6984 #endif |
6990 | 6985 |
7283 _("E535: Illegal character after <%c>"), | 7278 _("E535: Illegal character after <%c>"), |
7284 *--s); | 7279 *--s); |
7285 errmsg = errbuf; | 7280 errmsg = errbuf; |
7286 } | 7281 } |
7287 else | 7282 else |
7288 errmsg = (char_u *)""; | 7283 errmsg = ""; |
7289 break; | 7284 break; |
7290 } | 7285 } |
7291 } | 7286 } |
7292 } | 7287 } |
7293 } | 7288 } |
7443 /* 'foldmarker' */ | 7438 /* 'foldmarker' */ |
7444 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) | 7439 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) |
7445 { | 7440 { |
7446 p = vim_strchr(*varp, ','); | 7441 p = vim_strchr(*varp, ','); |
7447 if (p == NULL) | 7442 if (p == NULL) |
7448 errmsg = (char_u *)N_("E536: comma required"); | 7443 errmsg = N_("E536: comma required"); |
7449 else if (p == *varp || p[1] == NUL) | 7444 else if (p == *varp || p[1] == NUL) |
7450 errmsg = e_invarg; | 7445 errmsg = e_invarg; |
7451 else if (foldmethodIsMarker(curwin)) | 7446 else if (foldmethodIsMarker(curwin)) |
7452 foldUpdateAll(curwin); | 7447 foldUpdateAll(curwin); |
7453 } | 7448 } |
7454 /* 'commentstring' */ | 7449 /* 'commentstring' */ |
7455 else if (gvarp == &p_cms) | 7450 else if (gvarp == &p_cms) |
7456 { | 7451 { |
7457 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) | 7452 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) |
7458 errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s"); | 7453 errmsg = N_("E537: 'commentstring' must be empty or contain %s"); |
7459 } | 7454 } |
7460 /* 'foldopen' */ | 7455 /* 'foldopen' */ |
7461 else if (varp == &p_fdo) | 7456 else if (varp == &p_fdo) |
7462 { | 7457 { |
7463 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK) | 7458 if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK) |
7876 | 7871 |
7877 /* | 7872 /* |
7878 * Handle setting 'colorcolumn' or 'textwidth' in window "wp". | 7873 * Handle setting 'colorcolumn' or 'textwidth' in window "wp". |
7879 * Returns error message, NULL if it's OK. | 7874 * Returns error message, NULL if it's OK. |
7880 */ | 7875 */ |
7881 char_u * | 7876 char * |
7882 check_colorcolumn(win_T *wp) | 7877 check_colorcolumn(win_T *wp) |
7883 { | 7878 { |
7884 char_u *s; | 7879 char_u *s; |
7885 int col; | 7880 int col; |
7886 int count = 0; | 7881 int count = 0; |
7947 | 7942 |
7948 /* | 7943 /* |
7949 * Handle setting 'listchars' or 'fillchars'. | 7944 * Handle setting 'listchars' or 'fillchars'. |
7950 * Returns error message, NULL if it's OK. | 7945 * Returns error message, NULL if it's OK. |
7951 */ | 7946 */ |
7952 static char_u * | 7947 static char * |
7953 set_chars_option(char_u **varp) | 7948 set_chars_option(char_u **varp) |
7954 { | 7949 { |
7955 int round, i, len, entries; | 7950 int round, i, len, entries; |
7956 char_u *p, *s; | 7951 char_u *p, *s; |
7957 int c1, c2 = 0; | 7952 int c1, c2 = 0; |
8073 #ifdef FEAT_STL_OPT | 8068 #ifdef FEAT_STL_OPT |
8074 /* | 8069 /* |
8075 * Check validity of options with the 'statusline' format. | 8070 * Check validity of options with the 'statusline' format. |
8076 * Return error message or NULL. | 8071 * Return error message or NULL. |
8077 */ | 8072 */ |
8078 char_u * | 8073 char * |
8079 check_stl_option(char_u *s) | 8074 check_stl_option(char_u *s) |
8080 { | 8075 { |
8081 int itemcnt = 0; | 8076 int itemcnt = 0; |
8082 int groupdepth = 0; | 8077 int groupdepth = 0; |
8083 static char_u errbuf[80]; | 8078 static char errbuf[80]; |
8084 | 8079 |
8085 while (*s && itemcnt < STL_MAX_ITEM) | 8080 while (*s && itemcnt < STL_MAX_ITEM) |
8086 { | 8081 { |
8087 /* Check for valid keys after % sequences */ | 8082 /* Check for valid keys after % sequences */ |
8088 while (*s && *s != '%') | 8083 while (*s && *s != '%') |
8129 { | 8124 { |
8130 s++; | 8125 s++; |
8131 while (*s != '}' && *s) | 8126 while (*s != '}' && *s) |
8132 s++; | 8127 s++; |
8133 if (*s != '}') | 8128 if (*s != '}') |
8134 return (char_u *)N_("E540: Unclosed expression sequence"); | 8129 return N_("E540: Unclosed expression sequence"); |
8135 } | 8130 } |
8136 } | 8131 } |
8137 if (itemcnt >= STL_MAX_ITEM) | 8132 if (itemcnt >= STL_MAX_ITEM) |
8138 return (char_u *)N_("E541: too many items"); | 8133 return N_("E541: too many items"); |
8139 if (groupdepth != 0) | 8134 if (groupdepth != 0) |
8140 return (char_u *)N_("E542: unbalanced groups"); | 8135 return N_("E542: unbalanced groups"); |
8141 return NULL; | 8136 return NULL; |
8142 } | 8137 } |
8143 #endif | 8138 #endif |
8144 | 8139 |
8145 #ifdef FEAT_CLIPBOARD | 8140 #ifdef FEAT_CLIPBOARD |
8146 /* | 8141 /* |
8147 * Extract the items in the 'clipboard' option and set global values. | 8142 * Extract the items in the 'clipboard' option and set global values. |
8143 * Return an error message or NULL for success. | |
8148 */ | 8144 */ |
8149 static char_u * | 8145 static char * |
8150 check_clipboard_option(void) | 8146 check_clipboard_option(void) |
8151 { | 8147 { |
8152 int new_unnamed = 0; | 8148 int new_unnamed = 0; |
8153 int new_autoselect_star = FALSE; | 8149 int new_autoselect_star = FALSE; |
8154 int new_autoselect_plus = FALSE; | 8150 int new_autoselect_plus = FALSE; |
8155 int new_autoselectml = FALSE; | 8151 int new_autoselectml = FALSE; |
8156 int new_html = FALSE; | 8152 int new_html = FALSE; |
8157 regprog_T *new_exclude_prog = NULL; | 8153 regprog_T *new_exclude_prog = NULL; |
8158 char_u *errmsg = NULL; | 8154 char *errmsg = NULL; |
8159 char_u *p; | 8155 char_u *p; |
8160 | 8156 |
8161 for (p = p_cb; *p != NUL; ) | 8157 for (p = p_cb; *p != NUL; ) |
8162 { | 8158 { |
8163 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL)) | 8159 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL)) |
8233 return errmsg; | 8229 return errmsg; |
8234 } | 8230 } |
8235 #endif | 8231 #endif |
8236 | 8232 |
8237 #ifdef FEAT_SPELL | 8233 #ifdef FEAT_SPELL |
8238 static char_u * | 8234 /* |
8235 * Handle side effects of setting 'spell'. | |
8236 * Return an error message or NULL for success. | |
8237 */ | |
8238 static char * | |
8239 did_set_spell_option(int is_spellfile) | 8239 did_set_spell_option(int is_spellfile) |
8240 { | 8240 { |
8241 char_u *errmsg = NULL; | 8241 char *errmsg = NULL; |
8242 win_T *wp; | 8242 win_T *wp; |
8243 int l; | 8243 int l; |
8244 | 8244 |
8245 if (is_spellfile) | 8245 if (is_spellfile) |
8246 { | 8246 { |
8264 | 8264 |
8265 /* | 8265 /* |
8266 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. | 8266 * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. |
8267 * Return error message when failed, NULL when OK. | 8267 * Return error message when failed, NULL when OK. |
8268 */ | 8268 */ |
8269 static char_u * | 8269 static char * |
8270 compile_cap_prog(synblock_T *synblock) | 8270 compile_cap_prog(synblock_T *synblock) |
8271 { | 8271 { |
8272 regprog_T *rp = synblock->b_cap_prog; | 8272 regprog_T *rp = synblock->b_cap_prog; |
8273 char_u *re; | 8273 char_u *re; |
8274 | 8274 |
8351 | 8351 |
8352 /* | 8352 /* |
8353 * Set the value of a boolean option, and take care of side effects. | 8353 * Set the value of a boolean option, and take care of side effects. |
8354 * Returns NULL for success, or an error message for an error. | 8354 * Returns NULL for success, or an error message for an error. |
8355 */ | 8355 */ |
8356 static char_u * | 8356 static char * |
8357 set_bool_option( | 8357 set_bool_option( |
8358 int opt_idx, /* index in options[] table */ | 8358 int opt_idx, /* index in options[] table */ |
8359 char_u *varp, /* pointer to the option variable */ | 8359 char_u *varp, /* pointer to the option variable */ |
8360 int value, /* new value */ | 8360 int value, /* new value */ |
8361 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ | 8361 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ |
8469 /* Cannot set 'modifiable' when in Terminal mode. */ | 8469 /* Cannot set 'modifiable' when in Terminal mode. */ |
8470 if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) | 8470 if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) |
8471 && curbuf->b_term != NULL && !term_is_finished(curbuf)))) | 8471 && curbuf->b_term != NULL && !term_is_finished(curbuf)))) |
8472 { | 8472 { |
8473 curbuf->b_p_ma = FALSE; | 8473 curbuf->b_p_ma = FALSE; |
8474 return (char_u *)N_("E946: Cannot make a terminal with running job modifiable"); | 8474 return N_("E946: Cannot make a terminal with running job modifiable"); |
8475 } | 8475 } |
8476 # endif | 8476 # endif |
8477 # ifdef FEAT_TITLE | 8477 # ifdef FEAT_TITLE |
8478 redraw_titles(); | 8478 redraw_titles(); |
8479 # endif | 8479 # endif |
8605 | 8605 |
8606 FOR_ALL_WINDOWS(win) | 8606 FOR_ALL_WINDOWS(win) |
8607 if (win->w_p_pvw && win != curwin) | 8607 if (win->w_p_pvw && win != curwin) |
8608 { | 8608 { |
8609 curwin->w_p_pvw = FALSE; | 8609 curwin->w_p_pvw = FALSE; |
8610 return (char_u *)N_("E590: A preview window already exists"); | 8610 return N_("E590: A preview window already exists"); |
8611 } | 8611 } |
8612 } | 8612 } |
8613 } | 8613 } |
8614 #endif | 8614 #endif |
8615 | 8615 |
8763 /* 'spell' */ | 8763 /* 'spell' */ |
8764 else if ((int *)varp == &curwin->w_p_spell) | 8764 else if ((int *)varp == &curwin->w_p_spell) |
8765 { | 8765 { |
8766 if (curwin->w_p_spell) | 8766 if (curwin->w_p_spell) |
8767 { | 8767 { |
8768 char_u *errmsg = did_set_spelllang(curwin); | 8768 char *errmsg = did_set_spelllang(curwin); |
8769 | |
8769 if (errmsg != NULL) | 8770 if (errmsg != NULL) |
8770 EMSG(_(errmsg)); | 8771 emsg(_(errmsg)); |
8771 } | 8772 } |
8772 } | 8773 } |
8773 #endif | 8774 #endif |
8774 | 8775 |
8775 #ifdef FEAT_FKMAP | 8776 #ifdef FEAT_FKMAP |
8987 | 8988 |
8988 /* | 8989 /* |
8989 * Set the value of a number option, and take care of side effects. | 8990 * Set the value of a number option, and take care of side effects. |
8990 * Returns NULL for success, or an error message for an error. | 8991 * Returns NULL for success, or an error message for an error. |
8991 */ | 8992 */ |
8992 static char_u * | 8993 static char * |
8993 set_num_option( | 8994 set_num_option( |
8994 int opt_idx, /* index in options[] table */ | 8995 int opt_idx, /* index in options[] table */ |
8995 char_u *varp, /* pointer to the option variable */ | 8996 char_u *varp, /* pointer to the option variable */ |
8996 long value, /* new value */ | 8997 long value, /* new value */ |
8997 char_u *errbuf, /* buffer for error messages */ | 8998 char *errbuf, /* buffer for error messages */ |
8998 size_t errbuflen, /* length of "errbuf" */ | 8999 size_t errbuflen, /* length of "errbuf" */ |
8999 int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and | 9000 int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and |
9000 OPT_MODELINE */ | 9001 OPT_MODELINE */ |
9001 { | 9002 { |
9002 char_u *errmsg = NULL; | 9003 char *errmsg = NULL; |
9003 long old_value = *(long *)varp; | 9004 long old_value = *(long *)varp; |
9004 long old_Rows = Rows; /* remember old Rows */ | 9005 long old_Rows = Rows; /* remember old Rows */ |
9005 long old_Columns = Columns; /* remember old Columns */ | 9006 long old_Columns = Columns; /* remember old Columns */ |
9006 long *pp = (long *)varp; | 9007 long *pp = (long *)varp; |
9007 | 9008 |
9935 * Set the value of option "name". | 9936 * Set the value of option "name". |
9936 * Use "string" for string options, use "number" for other options. | 9937 * Use "string" for string options, use "number" for other options. |
9937 * | 9938 * |
9938 * Returns NULL on success or error message on error. | 9939 * Returns NULL on success or error message on error. |
9939 */ | 9940 */ |
9940 char_u * | 9941 char * |
9941 set_option_value( | 9942 set_option_value( |
9942 char_u *name, | 9943 char_u *name, |
9943 long number, | 9944 long number, |
9944 char_u *string, | 9945 char_u *string, |
9945 int opt_flags) /* OPT_LOCAL or 0 (both) */ | 9946 int opt_flags) /* OPT_LOCAL or 0 (both) */ |
9973 ttest(FALSE); | 9974 ttest(FALSE); |
9974 redraw_all_later(CLEAR); | 9975 redraw_all_later(CLEAR); |
9975 return NULL; | 9976 return NULL; |
9976 } | 9977 } |
9977 | 9978 |
9978 EMSG2(_("E355: Unknown option: %s"), name); | 9979 semsg(_("E355: Unknown option: %s"), name); |
9979 } | 9980 } |
9980 else | 9981 else |
9981 { | 9982 { |
9982 flags = options[opt_idx].flags; | 9983 flags = options[opt_idx].flags; |
9983 #ifdef HAVE_SANDBOX | 9984 #ifdef HAVE_SANDBOX |
9984 /* Disallow changing some options in the sandbox */ | 9985 /* Disallow changing some options in the sandbox */ |
9985 if (sandbox > 0 && (flags & P_SECURE)) | 9986 if (sandbox > 0 && (flags & P_SECURE)) |
9986 { | 9987 { |
9987 EMSG(_(e_sandbox)); | 9988 emsg(_(e_sandbox)); |
9988 return NULL; | 9989 return NULL; |
9989 } | 9990 } |
9990 #endif | 9991 #endif |
9991 if (flags & P_STRING) | 9992 if (flags & P_STRING) |
9992 return set_string_option(opt_idx, string, opt_flags); | 9993 return set_string_option(opt_idx, string, opt_flags); |
10006 if (string[idx] != NUL || idx == 0) | 10007 if (string[idx] != NUL || idx == 0) |
10007 { | 10008 { |
10008 /* There's another character after zeros or the string | 10009 /* There's another character after zeros or the string |
10009 * is empty. In both cases, we are trying to set a | 10010 * is empty. In both cases, we are trying to set a |
10010 * num option using a string. */ | 10011 * num option using a string. */ |
10011 EMSG3(_("E521: Number required: &%s = '%s'"), | 10012 semsg(_("E521: Number required: &%s = '%s'"), |
10012 name, string); | 10013 name, string); |
10013 return NULL; /* do nothing as we hit an error */ | 10014 return NULL; /* do nothing as we hit an error */ |
10014 | 10015 |
10015 } | 10016 } |
10016 } | 10017 } |
11084 #endif | 11085 #endif |
11085 #ifdef FEAT_VARTABS | 11086 #ifdef FEAT_VARTABS |
11086 case PV_VSTS: return (char_u *)&(curbuf->b_p_vsts); | 11087 case PV_VSTS: return (char_u *)&(curbuf->b_p_vsts); |
11087 case PV_VTS: return (char_u *)&(curbuf->b_p_vts); | 11088 case PV_VTS: return (char_u *)&(curbuf->b_p_vts); |
11088 #endif | 11089 #endif |
11089 default: IEMSG(_("E356: get_varp ERROR")); | 11090 default: iemsg(_("E356: get_varp ERROR")); |
11090 } | 11091 } |
11091 /* always return a valid pointer to avoid a crash! */ | 11092 /* always return a valid pointer to avoid a crash! */ |
11092 return (char_u *)&(curbuf->b_p_wm); | 11093 return (char_u *)&(curbuf->b_p_wm); |
11093 } | 11094 } |
11094 | 11095 |
12281 #endif | 12282 #endif |
12282 } | 12283 } |
12283 } | 12284 } |
12284 if (to == NUL) | 12285 if (to == NUL) |
12285 { | 12286 { |
12286 EMSG2(_("E357: 'langmap': Matching character missing for %s"), | 12287 semsg(_("E357: 'langmap': Matching character missing for %s"), |
12287 transchar(from)); | 12288 transchar(from)); |
12288 return; | 12289 return; |
12289 } | 12290 } |
12290 | 12291 |
12291 #ifdef FEAT_MBYTE | 12292 #ifdef FEAT_MBYTE |
12305 p = p2; | 12306 p = p2; |
12306 if (p[0] != NUL) | 12307 if (p[0] != NUL) |
12307 { | 12308 { |
12308 if (p[0] != ',') | 12309 if (p[0] != ',') |
12309 { | 12310 { |
12310 EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p); | 12311 semsg(_("E358: 'langmap': Extra characters after semicolon: %s"), p); |
12311 return; | 12312 return; |
12312 } | 12313 } |
12313 ++p; | 12314 ++p; |
12314 } | 12315 } |
12315 break; | 12316 break; |
12875 char_u *end; | 12876 char_u *end; |
12876 | 12877 |
12877 if (strtol((char *)cp, (char **)&end, 10) <= 0) | 12878 if (strtol((char *)cp, (char **)&end, 10) <= 0) |
12878 { | 12879 { |
12879 if (cp != end) | 12880 if (cp != end) |
12880 EMSG(_(e_positive)); | 12881 emsg(_(e_positive)); |
12881 else | 12882 else |
12882 EMSG(_(e_invarg)); | 12883 emsg(_(e_invarg)); |
12883 return FALSE; | 12884 return FALSE; |
12884 } | 12885 } |
12885 } | 12886 } |
12886 | 12887 |
12887 if (VIM_ISDIGIT(*cp)) | 12888 if (VIM_ISDIGIT(*cp)) |
12889 if (cp[0] == ',' && cp > var && cp[-1] != ',' && cp[1] != NUL) | 12890 if (cp[0] == ',' && cp > var && cp[-1] != ',' && cp[1] != NUL) |
12890 { | 12891 { |
12891 ++valcount; | 12892 ++valcount; |
12892 continue; | 12893 continue; |
12893 } | 12894 } |
12894 EMSG(_(e_invarg)); | 12895 emsg(_(e_invarg)); |
12895 return FALSE; | 12896 return FALSE; |
12896 } | 12897 } |
12897 | 12898 |
12898 *array = (int *)alloc((unsigned) ((valcount + 1) * sizeof(int))); | 12899 *array = (int *)alloc((unsigned) ((valcount + 1) * sizeof(int))); |
12899 (*array)[0] = valcount; | 12900 (*array)[0] = valcount; |