Bram,
this patch fixes this item from the todo list:

    /[^\n] does match at a line break.  Expected to do the same as /.

Vim now handles /[^\n] exactly like matching the '.'

While making this patch, I noticed, that currently echo match("\n", '.')
returns true. This might be unexpected, since '.' shouldn't match
newlines I guess. But changing this would be an incomptabile change,
since otherwise A^@A or A^MA wouldn't match anymore and I guess, this
wouldn't not be intended. So I left it untouched.

But it should probably be documented somewhere.

BTW, hg seems to handle the testfiles as binary files (probably because 
of the NUL in there). I hope this doesn't cause problems applying it, 
but if it does, I can mail you the 2 complete files.

regards,
Christian

-- 
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
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -2397,13 +2397,20 @@
 			    /* '\n' in range: also match NL */
 			    if (ret != JUST_CALC_SIZE)
 			    {
+				/* default for RE is to not match newlines, so
+				 * handle it like '.' */
 				if (*ret == ANYBUT)
-				    *ret = ANYBUT + ADD_NL;
+				{
+				    *ret = ANY + extra;
+				    *flagp |= HASWIDTH | SIMPLE;
+				}
 				else if (*ret == ANYOF)
+				{
 				    *ret = ANYOF + ADD_NL;
+				    *flagp |= HASNL;
+				}
 				/* else: must have had a \n already */
 			    }
-			    *flagp |= HASNL;
 			    regparse++;
 			    startc = -1;
 			}
@@ -4346,6 +4353,10 @@
 	    break; /* Matched with EOW */
 
 	  case ANY:
+	    /* ANY does not match new lines,
+	     * Is '.' allowed to match \n ?
+	     * /A.B matches A
B but also matches match("\n", '.')
+	     * it would break test79 so, only skip NUL */
 	    if (c == NUL)
 		status = RA_NOMATCH;
 	    else
diff --git a/src/testdir/test79.in b/src/testdir/test79.in
index 8fa11d9ad79cd389169051166babb22d8e1f4041..5bc9fd23bbdd6df8ee7057d44383fe9f29f4f1f1
GIT binary patch
literal 2571
zc%1E4OLv+;6n1^j$u?`6(@3-lH@*{lTo}Z6UP@QJwFeO&5y1eqUG=vY96={G2VHd6
z&7A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