diff options
author | Bram Moolenaar <bram@vim.org> | 2012-03-28 12:59:57 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2012-03-28 12:59:57 +0200 |
commit | 1798090bc37c07c832b2d60d64e99c93883a78b6 (patch) | |
tree | baae3c1e4a24b301b892208997a1c8003ed21818 | |
parent | a9d8f182183ed16b4ca17e80165a584e39e45ac0 (diff) | |
download | vim-1798090bc37c07c832b2d60d64e99c93883a78b6.tar.gz |
Problem: Changing 'virtualedit' in an operator function to "all" does not
have the desired effect. (Aaron Bohannon)
Solution: Save, reset and restore virtual_op when executing an operator
function.
-rw-r--r-- | src/normal.c | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c index aa470e4f..a7301162 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2279,6 +2279,7 @@ op_function(oap) { #ifdef FEAT_EVAL char_u *(argv[1]); + int save_virtual_op = virtual_op; if (*p_opfunc == NUL) EMSG(_("E774: 'operatorfunc' is empty")); @@ -2297,7 +2298,14 @@ op_function(oap) argv[0] = (char_u *)"line"; else argv[0] = (char_u *)"char"; + + /* Reset virtual_op so that 'virtualedit' can be changed in the + * function. */ + virtual_op = MAYBE; + (void)call_func_retnr(p_opfunc, 1, argv, FALSE); + + virtual_op = save_virtual_op; } #else EMSG(_("E775: Eval feature not available")); diff --git a/src/version.c b/src/version.c index 2598aeba..a1bd77c9 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 481, +/**/ 480, /**/ 479, |