| To: vim-dev@vim.org |
| Subject: patch 7.1.012 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.1.012 |
| Problem: ":let &shiftwidth = 'asdf'" doesn't produce an error message. |
| Solution: Check for a string argument. (Chris Lubinski) |
| Files: src/option.c |
| |
| |
| |
| |
| |
| *** 8219,8224 **** |
| --- 8219,8243 ---- |
| varp = get_varp(&options[opt_idx]); |
| if (varp != NULL) /* hidden option is not changed */ |
| { |
| + if (number == 0 && string != NULL) |
| + { |
| + int index; |
| + |
| + /* Either we are given a string or we are setting option |
| + * to zero. */ |
| + for (index = 0; string[index] == '0'; ++index) |
| + ; |
| + if (string[index] != NUL || index == 0) |
| + { |
| + /* There's another character after zeros or the string |
| + * is empty. In both cases, we are trying to set a |
| + * num option using a string. */ |
| + EMSG3(_("E521: Number required: &%s = '%s'"), |
| + name, string); |
| + return; /* do nothing as we hit an error */ |
| + |
| + } |
| + } |
| if (flags & P_NUM) |
| (void)set_num_option(opt_idx, varp, number, |
| NULL, 0, opt_flags); |
| |
| |
| |
| *** 668,669 **** |
| --- 668,671 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 12, |
| /**/ |
| |
| -- |
| Ten million Linux users can't be wrong! |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |