Hirohito Higashi wrote:
> Hi ChrisBra, cs86661 and list,
>
> 2017-4-20(Thr) 1:03:04 UTC+9 Christian Brabandt:
> > Yeah, it is a bug, Vim keeps searching and finding the same position and
> > does not return.
> >
> > I think this commit fixes it. (Note: The test will not finish, if run on an
> > unpatched vim)
>
> I think below patch is better.
> When `t` is not FAIL, add len to curwin->w_cursor.col simply.
>
> diff --git a/src/normal.c b/src/normal.c
> index 53bda6c..754aa5d 100644
> --- a/src/normal.c
> +++ b/src/normal.c
> @@ -4371,7 +4371,10 @@ find_decl(
> if ((pos = findmatchlimit(NULL, '}', FM_FORWARD,
> (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL
> && pos->lnum < old_pos.lnum)
> + {
> + curwin->w_cursor.col += len;
> continue;
> + }
> }
>
> if (t == FAIL)
The value of "len" is the length of the pattern. It may move the cursor
beyond the end of the line.
Hmm, there can't really be a valid match before the end of the block.
Thus we might as well move the cursor to "pos".
--
There are 2 kinds of people in my world: those who know Unix, Perl, Vim, GNU,
Linux, etc, and those who know COBOL. It gets very difficult for me at
parties, not knowing which group to socialise with :-)
Sitaram Chamarty
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.