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

ad4d7f446d

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-01-06 06:19:19 +08:00
parent 52e6059415
commit f38f86b1ad
3 changed files with 126 additions and 8 deletions

View File

@@ -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.