vim-patch:8.2.4753: error from setting an option is silently ignored (#19888)

Problem:    Error from setting an option is silently ignored.
Solution:   Handle option value errors better.  Fix uses of N_().
31e5c60a68
This commit is contained in:
zeertzjq
2022-08-22 13:56:50 +08:00
committed by GitHub
parent d4d27c41b3
commit 2bed0d1d97
20 changed files with 112 additions and 83 deletions

View File

@@ -1052,7 +1052,7 @@ static void command_line_scan(mparm_T *parmp)
} else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) {
parmp->use_vimrc = "NONE";
parmp->clean = true;
set_option_value("shadafile", 0L, "NONE", 0);
set_option_value_give_err("shadafile", 0L, "NONE", 0);
} else if (STRNICMP(argv[0] + argv_idx, "luamod-dev", 9) == 0) {
nlua_disable_preload = true;
} else {
@@ -1066,7 +1066,7 @@ static void command_line_scan(mparm_T *parmp)
}
break;
case 'A': // "-A" start in Arabic mode.
set_option_value("arabic", 1L, NULL, 0);
set_option_value_give_err("arabic", 1L, NULL, 0);
break;
case 'b': // "-b" binary mode.
// Needs to be effective before expanding file names, because
@@ -1097,10 +1097,10 @@ static void command_line_scan(mparm_T *parmp)
os_exit(0);
case 'H': // "-H" start in Hebrew mode: rl + hkmap set.
p_hkmap = true;
set_option_value("rl", 1L, NULL, 0);
set_option_value_give_err("rl", 1L, NULL, 0);
break;
case 'l': // "-l" lisp mode, 'lisp' and 'showmatch' on.
set_option_value("lisp", 1L, NULL, 0);
set_option_value_give_err("lisp", 1L, NULL, 0);
p_sm = true;
break;
case 'M': // "-M" no changes or writing of files
@@ -1181,7 +1181,7 @@ static void command_line_scan(mparm_T *parmp)
// default is 10: a little bit verbose
p_verbose = get_number_arg(argv[0], &argv_idx, 10);
if (argv[0][argv_idx] != NUL) {
set_option_value("verbosefile", 0L, argv[0] + argv_idx, 0);
set_option_value_give_err("verbosefile", 0L, argv[0] + argv_idx, 0);
argv_idx = (int)STRLEN(argv[0]);
}
break;
@@ -1189,7 +1189,7 @@ static void command_line_scan(mparm_T *parmp)
// "-w {scriptout}" write to script
if (ascii_isdigit(((char_u *)argv[0])[argv_idx])) {
n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value("window", n, NULL, 0);
set_option_value_give_err("window", n, NULL, 0);
break;
}
want_argument = true;
@@ -1284,7 +1284,7 @@ static void command_line_scan(mparm_T *parmp)
break;
case 'i': // "-i {shada}" use for shada
set_option_value("shadafile", 0L, argv[0], 0);
set_option_value_give_err("shadafile", 0L, argv[0], 0);
break;
case 's': { // "-s {scriptin}" read from script file
@@ -1334,7 +1334,7 @@ scripterror:
if (ascii_isdigit(*((char_u *)argv[0]))) {
argv_idx = 0;
n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value("window", n, NULL, 0);
set_option_value_give_err("window", n, NULL, 0);
argv_idx = -1;
break;
}
@@ -1735,7 +1735,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
p_shm_save = xstrdup((char *)p_shm);
snprintf(buf, sizeof(buf), "F%s", p_shm);
set_option_value("shm", 0L, buf, 0);
set_option_value_give_err("shm", 0L, buf, 0);
}
} else {
if (curwin->w_next == NULL) { // just checking
@@ -1779,7 +1779,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
}
if (p_shm_save != NULL) {
set_option_value("shm", 0L, p_shm_save, 0);
set_option_value_give_err("shm", 0L, p_shm_save, 0);
xfree(p_shm_save);
}