comparison 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
comparison
equal deleted inserted replaced
20894:04fa8b5b5f42 20895:56c86b167b68
24 */ 24 */
25 int 25 int
26 findsent(int dir, long count) 26 findsent(int dir, long count)
27 { 27 {
28 pos_T pos, tpos; 28 pos_T pos, tpos;
29 pos_T prev_pos;
29 int c; 30 int c;
30 int (*func)(pos_T *); 31 int (*func)(pos_T *);
31 int startlnum; 32 int startlnum;
32 int noskip = FALSE; // do not skip blanks 33 int noskip = FALSE; // do not skip blanks
33 int cpo_J; 34 int cpo_J;
39 else 40 else
40 func = decl; 41 func = decl;
41 42
42 while (count--) 43 while (count--)
43 { 44 {
45 prev_pos = pos;
46
44 /* 47 /*
45 * if on an empty line, skip up to a non-empty line 48 * if on an empty line, skip up to a non-empty line
46 */ 49 */
47 if (gchar_pos(&pos) == NUL) 50 if (gchar_pos(&pos) == NUL)
48 { 51 {
131 found: 134 found:
132 // skip white space 135 // skip white space
133 while (!noskip && ((c = gchar_pos(&pos)) == ' ' || c == '\t')) 136 while (!noskip && ((c = gchar_pos(&pos)) == ' ' || c == '\t'))
134 if (incl(&pos) == -1) 137 if (incl(&pos) == -1)
135 break; 138 break;
139
140 if (EQUAL_POS(prev_pos, pos))
141 {
142 // didn't actually move, advance one character and try again
143 if ((*func)(&pos) == -1)
144 {
145 if (count)
146 return FAIL;
147 break;
148 }
149 ++count;
150 }
136 } 151 }
137 152
138 setpcmark(); 153 setpcmark();
139 curwin->w_cursor = pos; 154 curwin->w_cursor = pos;
140 return OK; 155 return OK;