Mercurial > vim
comparison src/ops.c @ 26007:1d2e1c23e458 v8.2.3537
patch 8.2.3537: mode() does not return the right value in 'operatorfunc'
Commit: https://github.com/vim/vim/commit/75c30e96cf280a8cc01ac01c41a9252db3e503cc
Author: naohiro ono <obcat@icloud.com>
Date: Tue Oct 19 11:15:41 2021 +0100
patch 8.2.3537: mode() does not return the right value in 'operatorfunc'
Problem: mode() does not return the right value in 'operatorfunc'.
Solution: Reset finish_op while calling 'operatorfunc'.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 19 Oct 2021 12:30:05 +0200 |
parents | b1440083f0da |
children | 6b4f017d7005 |
comparison
equal
deleted
inserted
replaced
26006:412aa3ebb70c | 26007:1d2e1c23e458 |
---|---|
3312 op_function(oparg_T *oap UNUSED) | 3312 op_function(oparg_T *oap UNUSED) |
3313 { | 3313 { |
3314 #ifdef FEAT_EVAL | 3314 #ifdef FEAT_EVAL |
3315 typval_T argv[2]; | 3315 typval_T argv[2]; |
3316 int save_virtual_op = virtual_op; | 3316 int save_virtual_op = virtual_op; |
3317 int save_finish_op = finish_op; | |
3317 pos_T orig_start = curbuf->b_op_start; | 3318 pos_T orig_start = curbuf->b_op_start; |
3318 pos_T orig_end = curbuf->b_op_end; | 3319 pos_T orig_end = curbuf->b_op_end; |
3319 | 3320 |
3320 if (*p_opfunc == NUL) | 3321 if (*p_opfunc == NUL) |
3321 emsg(_("E774: 'operatorfunc' is empty")); | 3322 emsg(_("E774: 'operatorfunc' is empty")); |
3339 | 3340 |
3340 // Reset virtual_op so that 'virtualedit' can be changed in the | 3341 // Reset virtual_op so that 'virtualedit' can be changed in the |
3341 // function. | 3342 // function. |
3342 virtual_op = MAYBE; | 3343 virtual_op = MAYBE; |
3343 | 3344 |
3345 // Reset finish_op so that mode() returns the right value. | |
3346 finish_op = FALSE; | |
3347 | |
3344 (void)call_func_noret(p_opfunc, 1, argv); | 3348 (void)call_func_noret(p_opfunc, 1, argv); |
3345 | 3349 |
3346 virtual_op = save_virtual_op; | 3350 virtual_op = save_virtual_op; |
3351 finish_op = save_finish_op; | |
3347 if (cmdmod.cmod_flags & CMOD_LOCKMARKS) | 3352 if (cmdmod.cmod_flags & CMOD_LOCKMARKS) |
3348 { | 3353 { |
3349 curbuf->b_op_start = orig_start; | 3354 curbuf->b_op_start = orig_start; |
3350 curbuf->b_op_end = orig_end; | 3355 curbuf->b_op_end = orig_end; |
3351 } | 3356 } |