aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textobject.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-06 06:19:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-01-06 06:24:02 +0800
commitf38f86b1ad8ad2ae3236f36e56fcdb416f679e65 (patch)
tree135f5f2c8999c02ce4b2368911d6f9ec3fd39c3e /src/nvim/textobject.c
parent52e6059415ba40b955267a9b447b5c57fc45b397 (diff)
downloadrneovim-f38f86b1ad8ad2ae3236f36e56fcdb416f679e65.tar.gz
rneovim-f38f86b1ad8ad2ae3236f36e56fcdb416f679e65.tar.bz2
rneovim-f38f86b1ad8ad2ae3236f36e56fcdb416f679e65.zip
vim-patch:9.1.0007: can select empty inner text blocks
Problem: can select empty inner text blocks (laurentalacoque) Solution: make selecting empty inner text blocks an error textobjects: Make selecting inner empty blocks an error fixes: vim/vim#13514 closes: vim/vim#13523 https://github.com/vim/vim/commit/ad4d7f446dc6754bde212234d46f4849b520b6e0 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/textobject.c')
-rw-r--r--src/nvim/textobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index 3d8e7c9901..3e696167e2 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -955,6 +955,12 @@ 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
+ return FAIL;
+ }
+
// In Visual mode, when the resulting area is not bigger than what we
// started with, extend it to the next block, and then exclude again.
// Don't try to expand the area if the area is empty.