Mercurial > vim
diff src/option.c @ 31950:b0717fcca5eb v9.0.1307
patch 9.0.1307: setting 'formatoptions' with :let doesn't check for errors
Commit: https://github.com/vim/vim/commit/32ff96ef018eb1a5bea0953648b4892a6ee71658
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Feb 13 16:10:04 2023 +0000
patch 9.0.1307: setting 'formatoptions' with :let doesn't check for errors
Problem: Setting 'formatoptions' with :let doesn't check for errors.
Solution: Pass "errbuf" to set_string_option(). (Yegappan Lakshmanan,
closes #11974, closes #11972)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Feb 2023 17:15:04 +0100 |
parents | 6072c1d9fe2a |
children | 360efef7e5df |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -5135,6 +5135,7 @@ set_option_value( int opt_idx; char_u *varp; long_u flags; + static char errbuf[80]; opt_idx = findoption(name); if (opt_idx < 0) @@ -5177,7 +5178,7 @@ set_option_value( } #endif if (flags & P_STRING) - return set_string_option(opt_idx, string, opt_flags); + return set_string_option(opt_idx, string, opt_flags, errbuf); varp = get_varp_scope(&(options[opt_idx]), opt_flags); if (varp != NULL) // hidden option is not changed @@ -5202,8 +5203,10 @@ set_option_value( } } if (flags & P_NUM) + { return set_num_option(opt_idx, varp, number, - NULL, 0, opt_flags); + errbuf, sizeof(errbuf), opt_flags); + } else return set_bool_option(opt_idx, varp, (int)number, opt_flags); }