diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-22 21:08:14 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-09-22 21:09:31 +0800 |
commit | 4371886293b4956530f8bec49b01c0ee02771434 (patch) | |
tree | 8278edf809a5e8873ac3208459558259566ac9f9 /src/nvim/option.c | |
parent | 33f147147224010cd11a4d4fe5c88d7773a709ac (diff) | |
download | rneovim-4371886293b4956530f8bec49b01c0ee02771434.tar.gz rneovim-4371886293b4956530f8bec49b01c0ee02771434.tar.bz2 rneovim-4371886293b4956530f8bec49b01c0ee02771434.zip |
vim-patch:9.0.0544: minor issues with setting a string option
Problem: Minor issues with setting a string option.
Solution: Adjust the code, add a test. (closes vim/vim#11192)
https://github.com/vim/vim/commit/fcba86c0316dc0d6341078b50e7967206a1627a0
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 62e4e74f2d..5b67f0e471 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -854,11 +854,9 @@ static int do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, // Set 'keywordprg' to ":help" if an empty // value was passed to :set by the user. - // Misuse errbuf[] for the resulting string. if (varp == (char *)&p_kp && (*arg == NUL || *arg == ' ')) { - STRCPY(errbuf, ":help"); save_arg = arg; - arg = errbuf; + arg = ":help"; } else if (varp == (char *)&p_bs && ascii_isdigit(**(char_u **)varp)) { // Convert 'backspace' number to string, for // adding, prepending and removing string. @@ -936,7 +934,7 @@ static int do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, // are not removed, and keep backslash at start, for "\\machine\path", // but do remove it for "\\\\machine\\path". // The reverse is found in ExpandOldSetting(). - while (*arg && !ascii_iswhite(*arg)) { + while (*arg != NUL && !ascii_iswhite(*arg)) { if (*arg == '\\' && arg[1] != NUL #ifdef BACKSLASH_IN_FILENAME && !((flags & P_EXPAND) @@ -1062,8 +1060,8 @@ static int do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, } } - if (save_arg != NULL) { // number for 'whichwrap' - arg = save_arg; + if (save_arg != NULL) { + arg = save_arg; // arg was temporarily changed, restore it } } |