Mercurial > vim
comparison src/evalvars.c @ 20148:fadb7f84beff v8.2.0629
patch 8.2.0629: setting a boolean option to v:false does not work
Commit: https://github.com/vim/vim/commit/65d032c779a43b767497e15e6a32d04a6a8fa65d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 24 20:57:01 2020 +0200
patch 8.2.0629: setting a boolean option to v:false does not work
Problem: Setting a boolean option to v:false does not work.
Solution: Do not use the string representation of the value. (Christian
Brabandt, closes #5974)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 24 Apr 2020 21:00:04 +0200 |
parents | f40231487a49 |
children | 5f9c2c7d3d73 |
comparison
equal
deleted
inserted
replaced
20147:fe776cc8b871 | 20148:fadb7f84beff |
---|---|
1249 { | 1249 { |
1250 long n; | 1250 long n; |
1251 int opt_type; | 1251 int opt_type; |
1252 long numval; | 1252 long numval; |
1253 char_u *stringval = NULL; | 1253 char_u *stringval = NULL; |
1254 char_u *s; | 1254 char_u *s = NULL; |
1255 | 1255 |
1256 c1 = *p; | 1256 c1 = *p; |
1257 *p = NUL; | 1257 *p = NUL; |
1258 | 1258 |
1259 n = (long)tv_get_number(tv); | 1259 n = (long)tv_get_number(tv); |
1260 s = tv_get_string_chk(tv); // != NULL if number or string | 1260 // avoid setting a string option to the text "v:false" or similar. |
1261 if (tv->v_type != VAR_BOOL && tv->v_type != VAR_SPECIAL) | |
1262 s = tv_get_string_chk(tv); // != NULL if number or string | |
1261 if (s != NULL && op != NULL && *op != '=') | 1263 if (s != NULL && op != NULL && *op != '=') |
1262 { | 1264 { |
1263 opt_type = get_option_value(arg, &numval, | 1265 opt_type = get_option_value(arg, &numval, |
1264 &stringval, opt_flags); | 1266 &stringval, opt_flags); |
1265 if ((opt_type == 1 && *op == '.') | 1267 if ((opt_type == 1 && *op == '.') |
1287 vim_free(stringval); | 1289 vim_free(stringval); |
1288 stringval = s; | 1290 stringval = s; |
1289 } | 1291 } |
1290 } | 1292 } |
1291 } | 1293 } |
1292 if (s != NULL) | 1294 if (s != NULL || tv->v_type == VAR_BOOL |
1295 || tv->v_type == VAR_SPECIAL) | |
1293 { | 1296 { |
1294 set_option_value(arg, n, s, opt_flags); | 1297 set_option_value(arg, n, s, opt_flags); |
1295 arg_end = p; | 1298 arg_end = p; |
1296 } | 1299 } |
1297 *p = c1; | 1300 *p = c1; |