patch 8.2.3255: ci" finds following string but ci< and others don't
Problem: ci" finds following string but ci< and others don't.
Solution: When not inside an object find the start. (Connor Lane Smit,
closes #8670)
diff --git a/src/textobject.c b/src/textobject.c
index 2d5d5dd..e4a7db3 100644
--- a/src/textobject.c
+++ b/src/textobject.c
@@ -1079,12 +1079,25 @@
*/
save_cpo = p_cpo;
p_cpo = (char_u *)(vim_strchr(p_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%");
- while (count-- > 0)
+ if ((pos = findmatch(NULL, what)) != NULL)
{
- if ((pos = findmatch(NULL, what)) == NULL)
- break;
- curwin->w_cursor = *pos;
- start_pos = *pos; // the findmatch for end_pos will overwrite *pos
+ while (count-- > 0)
+ {
+ if ((pos = findmatch(NULL, what)) == NULL)
+ break;
+ curwin->w_cursor = *pos;
+ start_pos = *pos; // the findmatch for end_pos will overwrite *pos
+ }
+ }
+ else
+ {
+ while (count-- > 0)
+ {
+ if ((pos = findmatchlimit(NULL, what, FM_FORWARD, 0)) == NULL)
+ break;
+ curwin->w_cursor = *pos;
+ start_pos = *pos; // the findmatch for end_pos will overwrite *pos
+ }
}
p_cpo = save_cpo;