0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.3.1004

Problem:    No error when option could not be set.
Solution:   Report an error. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-05-21 22:38:18 +02:00
parent 2a0f3d3fb2
commit c96ebe75e5
6 changed files with 55 additions and 15 deletions

View File

@@ -1520,6 +1520,25 @@ OptionsItem(OptionsObject *self, PyObject *keyObject)
}
}
static int
set_option_value_err(key, numval, stringval, opt_flags)
char_u *key;
int numval;
char_u *stringval;
int opt_flags;
{
char_u *errmsg;
if ((errmsg = set_option_value(key, numval, stringval, opt_flags)))
{
if (VimTryEnd())
return FAIL;
PyErr_SetVim((char *)errmsg);
return FAIL;
}
return OK;
}
static int
set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
char_u *key;
@@ -1532,6 +1551,7 @@ set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
win_T *save_curwin = NULL;
tabpage_T *save_curtab = NULL;
buf_T *save_curbuf = NULL;
int r = 0;
VimTryStart();
switch (opt_type)
@@ -1545,16 +1565,22 @@ set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
PyErr_SetVim("Problem while switching windows.");
return -1;
}
set_option_value(key, numval, stringval, opt_flags);
r = set_option_value_err(key, numval, stringval, opt_flags);
restore_win(save_curwin, save_curtab);
if (r == FAIL)
return -1;
break;
case SREQ_BUF:
switch_buffer(&save_curbuf, (buf_T *)from);
set_option_value(key, numval, stringval, opt_flags);
r = set_option_value_err(key, numval, stringval, opt_flags);
restore_buffer(save_curbuf);
if (r == FAIL)
return -1;
break;
case SREQ_GLOBAL:
set_option_value(key, numval, stringval, opt_flags);
r = set_option_value_err(key, numval, stringval, opt_flags);
if (r == FAIL)
return -1;
break;
}
return VimTryEnd();
@@ -1611,6 +1637,7 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
if (flags & SOPT_BOOL)
{
int istrue = PyObject_IsTrue(valObject);
if (istrue == -1)
return -1;
r = set_option_value_for(key, istrue, NULL,