diff src/textobject.c @ 20895:56c86b167b68 v8.2.0999

patch 8.2.0999: moving to next sentence gets stuck on quote Commit: https://github.com/vim/vim/commit/2f03e5a0a9cfaabb01c57dd3348a05e86c26623c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 18 15:33:25 2020 +0200 patch 8.2.0999: moving to next sentence gets stuck on quote Problem: Moving to next sentence gets stuck on quote. Solution: When moving to the next sentence doesn't result in moving, advance a character and try again. (closes #6291)
author Bram Moolenaar <Bram@vim.org>
date Thu, 18 Jun 2020 15:45:04 +0200
parents 6ca6a372fef6
children 3ac0ef0578ef
line wrap: on
line diff
--- a/src/textobject.c
+++ b/src/textobject.c
@@ -26,6 +26,7 @@ static int skip_chars(int, int);
 findsent(int dir, long count)
 {
     pos_T	pos, tpos;
+    pos_T	prev_pos;
     int		c;
     int		(*func)(pos_T *);
     int		startlnum;
@@ -41,6 +42,8 @@ findsent(int dir, long count)
 
     while (count--)
     {
+	prev_pos = pos;
+
 	/*
 	 * if on an empty line, skip up to a non-empty line
 	 */
@@ -133,6 +136,18 @@ found:
 	while (!noskip && ((c = gchar_pos(&pos)) == ' ' || c == '\t'))
 	    if (incl(&pos) == -1)
 		break;
+
+	if (EQUAL_POS(prev_pos, pos))
+	{
+	    // didn't actually move, advance one character and try again
+	    if ((*func)(&pos) == -1)
+	    {
+		if (count)
+		    return FAIL;
+		break;
+	    }
+	    ++count;
+	}
     }
 
     setpcmark();