Bram,
here is a patch that fixes a bug with gn when the match is only a single
char width.
regards,
Christian
--
Die Ursache, die den Aberglauben hervorbringt, erhält und ernährt, ist
die Furcht.
-- Baruch de Spinoza (Tractatus theologico-politicus)
--
--
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/groups/opt_out.
diff --git a/src/search.c b/src/search.c
--- a/src/search.c
+++ b/src/search.c
@@ -4489,7 +4489,7 @@
#endif /* FEAT_TEXTOBJ */
#if defined(FEAT_VISUAL) || defined(PROTO)
-static int is_zerowidth __ARGS((char_u *pattern));
+static int is_zerowidth __ARGS((char_u *pattern, int one_char));
/*
* Find next search match under cursor, cursor at end.
@@ -4540,7 +4540,7 @@
orig_pos = pos = start_pos = curwin->w_cursor;
/* Is the pattern is zero-width? */
- zerowidth = is_zerowidth(spats[last_idx].pat);
+ zerowidth = is_zerowidth(spats[last_idx].pat, TRUE);
if (zerowidth == -1)
return FAIL;
@@ -4645,12 +4645,13 @@
}
/*
- * Check if the pattern is zero-width.
+ * Check if the pattern is zero-width (or only 1 display char width)
* Returns TRUE, FALSE or -1 for failure.
*/
static int
-is_zerowidth(pattern)
+is_zerowidth(pattern, one_char)
char_u *pattern;
+ int one_char; /* TRUE: pattern is zero-width or one char width */
{
regmmatch_T regmatch;
int nmatched = 0;
@@ -4677,6 +4678,10 @@
result = (nmatched != 0
&& regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
+
+ if (one_char && !result && incl(&pos) == 0 &&
+ pos.col == regmatch.endpos[0].col)
+ result = TRUE;
}
called_emsg |= save_called_emsg;
diff --git a/src/testdir/test53.in b/src/testdir/test53.in
--- a/src/testdir/test53.in
+++ b/src/testdir/test53.in
@@ -44,7 +44,8 @@
vlgnd
/mother
:set selection=exclusive
-$cgNmongoose
+$cgNmongoose/i
+cgnj
:/^start:/,/^end:/wq! test.out
ENDTEST
@@ -73,4 +74,5 @@
delete first and last chars
uniquepattern uniquepattern
my very excellent mother just served us nachos
+for (i=0; i<=10; i++)
end:
diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok
--- a/src/testdir/test53.ok
+++ b/src/testdir/test53.ok
@@ -26,4 +26,5 @@
elete first and last char
uniquepattern
my very excellent mongoose just served us nachos
+for (j=0; i<=10; i++)
end: