aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/state.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-01-27 08:34:57 +0100
committerGitHub <noreply@github.com>2022-01-27 08:34:57 +0100
commitd50dd1272550346164b05cfc82b3a0aea6dd6b84 (patch)
tree6612fbc107618b04ea830b076f9510f5111a030d /src/nvim/state.c
parent55ad48d93955462905622a42a460ffccd99aa77a (diff)
parent6c22e5fd1a4e6d945bb76a4a8a558613f99ec793 (diff)
downloadrneovim-d50dd1272550346164b05cfc82b3a0aea6dd6b84.tar.gz
rneovim-d50dd1272550346164b05cfc82b3a0aea6dd6b84.tar.bz2
rneovim-d50dd1272550346164b05cfc82b3a0aea6dd6b84.zip
Merge pull request #17095 from zeertzjq/vim-8.2.3227
vim-patch:8.2.{3227,3280,4094}: global-local 'virtualedit'
Diffstat (limited to 'src/nvim/state.c')
-rw-r--r--src/nvim/state.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 1fe8bb671d..9e4c9b2bad 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -12,6 +12,7 @@
#include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/main.h"
+#include "nvim/option.h"
#include "nvim/option_defs.h"
#include "nvim/os/input.h"
#include "nvim/state.h"
@@ -107,15 +108,17 @@ void state_handle_k_event(void)
/// Return true if in the current mode we need to use virtual.
bool virtual_active(void)
{
+ unsigned int cur_ve_flags = get_ve_flags();
+
// While an operator is being executed we return "virtual_op", because
// VIsual_active has already been reset, thus we can't check for "block"
// being used.
if (virtual_op != kNone) {
return virtual_op;
}
- return ve_flags == VE_ALL
- || ((ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V)
- || ((ve_flags & VE_INSERT) && (State & INSERT));
+ return cur_ve_flags == VE_ALL
+ || ((cur_ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V)
+ || ((cur_ve_flags & VE_INSERT) && (State & INSERT));
}
/// VISUAL, SELECTMODE and OP_PENDING State are never set, they are equal to