aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textobject.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-06 06:24:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-01-06 06:25:37 +0800
commit14918118e86a7d113331f4445c51e6e48a6a99c4 (patch)
tree08ad93af5856730086f247868b3e1c1915184fbe /src/nvim/textobject.c
parentf38f86b1ad8ad2ae3236f36e56fcdb416f679e65 (diff)
downloadrneovim-14918118e86a7d113331f4445c51e6e48a6a99c4.tar.gz
rneovim-14918118e86a7d113331f4445c51e6e48a6a99c4.tar.bz2
rneovim-14918118e86a7d113331f4445c51e6e48a6a99c4.zip
vim-patch:9.1.0012: regression with empty inner blocks introduced
Problem: regression with empty inner blocks introduced (after v9.1.0007) Solution: Set correct cursor position, Check for visual mode being active (Maxim Kim) relates: vim/vim#13514 closes: vim/vim#13819 https://github.com/vim/vim/commit/3779516988f14f2070d827514c79383334a0946b Co-authored-by: Maxim Kim <habamax@gmail.com>
Diffstat (limited to 'src/nvim/textobject.c')
-rw-r--r--src/nvim/textobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index 3e696167e2..76ea24039a 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -955,9 +955,10 @@ int current_block(oparg_T *oap, int count, bool include, int what, int other)
}
}
- if (equalpos(start_pos, *end_pos)) {
- // empty block like this: ()
- // there is no inner block to select, abort
+ // In Visual mode, when resulting area is empty
+ // i.e. there is no inner block to select, abort.
+ if (equalpos(start_pos, *end_pos) && VIsual_active) {
+ curwin->w_cursor = old_pos;
return FAIL;
}