@@ -311,6 +311,7 @@ function M.next_textobject(node, query_string, query_group, same_parent, overlap
311311 local search_start , _
312312 if overlapping_range_ok then
313313 _ , _ , search_start = node :start ()
314+ search_start = search_start + 1
314315 else
315316 _ , _ , search_start = node :end_ ()
316317 end
@@ -321,7 +322,7 @@ function M.next_textobject(node, query_string, query_group, same_parent, overlap
321322 if not same_parent or node :parent () == match .node :parent () then
322323 local _ , _ , start = match .node :start ()
323324 local _ , _ , end_ = match .node :end_ ()
324- return start > search_start and end_ >= node_end
325+ return start >= search_start and end_ >= node_end
325326 end
326327 end
327328 local function scoring_function (match )
@@ -346,7 +347,7 @@ function M.previous_textobject(node, query_string, query_group, same_parent, ove
346347 local search_end , _
347348 if overlapping_range_ok then
348349 _ , _ , search_end = node :end_ ()
349- search_end = search_end + 1
350+ search_end = search_end - 1
350351 else
351352 _ , _ , search_end = node :start ()
352353 end
@@ -355,7 +356,7 @@ function M.previous_textobject(node, query_string, query_group, same_parent, ove
355356 if not same_parent or node :parent () == match .node :parent () then
356357 local _ , _ , end_ = match .node :end_ ()
357358 local _ , _ , start = match .node :start ()
358- return end_ < search_end and start < node_start
359+ return end_ <= search_end and start < node_start
359360 end
360361 end
361362
0 commit comments