From 14918118e86a7d113331f4445c51e6e48a6a99c4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Jan 2024 06:24:15 +0800 Subject: 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 --- src/nvim/textobject.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/nvim/textobject.c') 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; } -- cgit