aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textobject.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /src/nvim/textobject.c
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/textobject.c')
-rw-r--r--src/nvim/textobject.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index 3c81a840ea..45978765bf 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -1193,13 +1193,18 @@ again:
pos_T end_pos = curwin->w_cursor;
if (!do_include) {
- // Exclude the start tag.
+ // Exclude the start tag,
+ // but skip over '>' if it appears in quotes
+ bool in_quotes = false;
curwin->w_cursor = start_pos;
while (inc_cursor() >= 0) {
- if (*get_cursor_pos_ptr() == '>') {
+ p = get_cursor_pos_ptr();
+ if (*p == '>' && !in_quotes) {
inc_cursor();
start_pos = curwin->w_cursor;
break;
+ } else if (*p == '"' || *p == '\'') {
+ in_quotes = !in_quotes;
}
}
curwin->w_cursor = end_pos;
@@ -1264,11 +1269,7 @@ int current_par(oparg_T *oap, int count, bool include, int type)
// When visual area is more than one line: extend it.
if (VIsual_active && start_lnum != VIsual.lnum) {
extend:
- if (start_lnum < VIsual.lnum) {
- dir = BACKWARD;
- } else {
- dir = FORWARD;
- }
+ dir = start_lnum < VIsual.lnum ? BACKWARD : FORWARD;
for (int i = count; --i >= 0;) {
if (start_lnum ==
(dir == BACKWARD ? 1 : curbuf->b_ml.ml_line_count)) {