summaryrefslogtreecommitdiff
path: root/src/if_py_both.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index b658ce36..777e7dae 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -1521,6 +1521,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;
int numval;
@@ -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,