diff options
Diffstat (limited to 'src/nvim/state.c')
-rw-r--r-- | src/nvim/state.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/nvim/state.c b/src/nvim/state.c index 908f724792..c4041dda07 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -138,17 +138,23 @@ void state_handle_k_event(void) /// Return true if in the current mode we need to use virtual. bool virtual_active(win_T *wp) { - unsigned cur_ve_flags = get_ve_flags(wp); - // 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 cur_ve_flags == VE_ALL - || ((cur_ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V) - || ((cur_ve_flags & VE_INSERT) && (State & MODE_INSERT)); + + // In Terminal mode the cursor can be positioned anywhere by the application + if (State & MODE_TERMINAL) { + return true; + } + + unsigned cur_ve_flags = get_ve_flags(wp); + + return cur_ve_flags == kOptVeFlagAll + || ((cur_ve_flags & kOptVeFlagBlock) && VIsual_active && VIsual_mode == Ctrl_V) + || ((cur_ve_flags & kOptVeFlagInsert) && (State & MODE_INSERT)); } /// MODE_VISUAL, MODE_SELECT and MODE_OP_PENDING State are never set, they are |