Patch 8.2.0999

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 18, 2020, 9:34:31 AM6/18/20
to vim...@googlegroups.com

Patch 8.2.0999
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)
Files: src/textobject.c, src/testdir/test_textobjects.vim


*** ../vim-8.2.0998/src/textobject.c 2020-04-29 21:03:51.119170214 +0200
--- src/textobject.c 2020-06-18 15:22:43.347311205 +0200
***************
*** 26,31 ****
--- 26,32 ----
findsent(int dir, long count)
{
pos_T pos, tpos;
+ pos_T prev_pos;
int c;
int (*func)(pos_T *);
int startlnum;
***************
*** 41,46 ****
--- 42,49 ----

while (count--)
{
+ prev_pos = pos;
+
/*
* if on an empty line, skip up to a non-empty line
*/
***************
*** 133,138 ****
--- 136,153 ----
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();
*** ../vim-8.2.0998/src/testdir/test_textobjects.vim 2020-04-28 20:29:04.237851565 +0200
--- src/testdir/test_textobjects.vim 2020-06-18 13:17:25.309390217 +0200
***************
*** 311,316 ****
--- 311,327 ----
normal! 17|yas
call assert_equal("A '([sentence.])' ", @")

+ " don't get stuck on a quote at the start of a sentence
+ %delete _
+ call setline(1, ['A sentence.', '"A sentence"?', 'A sentence!'])
+ normal gg))
+ call assert_equal(3, getcurpos()[1])
+
+ %delete _
+ call setline(1, ['A sentence.', "'A sentence'?", 'A sentence!'])
+ normal gg))
+ call assert_equal(3, getcurpos()[1])
+
%delete _
endfunc

*** ../vim-8.2.0998/src/version.c 2020-06-17 22:58:31.044411790 +0200
--- src/version.c 2020-06-18 15:31:13.025922062 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 999,
/**/

--
CONCORDE: Quickly, sir, come this way!
LAUNCELOT: No! It's not right for my idiom. I must escape more ... more ...
CONCORDE: Dramatically, sir?
LAUNCELOT: Dramatically.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages