comparison src/typval.c @ 26441:65ab0b035dd8 v8.2.3751

patch 8.2.3751: cannot assign a lambda to an option that takes a function Commit: https://github.com/vim/vim/commit/6409553b6e3b4de4e1d72b8ee5445595214581ff Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Dec 6 11:03:55 2021 +0000 patch 8.2.3751: cannot assign a lambda to an option that takes a function Problem: Cannot assign a lambda to an option that takes a function. Solution: Automatically convert the lambda to a string. (Yegappan Lakshmanan, closes #9286)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Dec 2021 12:15:04 +0100
parents 936f77929f16
children 0d2a709e2ff0
comparison
equal deleted inserted replaced
26440:f6f5f604c17c 26441:65ab0b035dd8
1637 char_u *stringval; 1637 char_u *stringval;
1638 getoption_T opt_type; 1638 getoption_T opt_type;
1639 int c; 1639 int c;
1640 int working = (**arg == '+'); // has("+option") 1640 int working = (**arg == '+'); // has("+option")
1641 int ret = OK; 1641 int ret = OK;
1642 int opt_flags; 1642 int scope;
1643 1643
1644 // Isolate the option name and find its value. 1644 // Isolate the option name and find its value.
1645 option_end = find_option_end(arg, &opt_flags); 1645 option_end = find_option_end(arg, &scope);
1646 if (option_end == NULL) 1646 if (option_end == NULL)
1647 { 1647 {
1648 if (rettv != NULL) 1648 if (rettv != NULL)
1649 semsg(_("E112: Option name missing: %s"), *arg); 1649 semsg(_("E112: Option name missing: %s"), *arg);
1650 return FAIL; 1650 return FAIL;
1657 } 1657 }
1658 1658
1659 c = *option_end; 1659 c = *option_end;
1660 *option_end = NUL; 1660 *option_end = NUL;
1661 opt_type = get_option_value(*arg, &numval, 1661 opt_type = get_option_value(*arg, &numval,
1662 rettv == NULL ? NULL : &stringval, opt_flags); 1662 rettv == NULL ? NULL : &stringval, NULL, scope);
1663 1663
1664 if (opt_type == gov_unknown) 1664 if (opt_type == gov_unknown)
1665 { 1665 {
1666 if (rettv != NULL) 1666 if (rettv != NULL)
1667 semsg(_(e_unknown_option), *arg); 1667 semsg(_(e_unknown_option), *arg);