Patch 7.3.796
Problem:    "/[^\n]" does match at a line break.
Solution:   Make it do the same as "/.". (Christian Brabandt)
Files:      src/regexp.c, src/testdir/test79.in, src/testdir/test79.ok


*** ../vim-7.3.795/src/regexp.c 2013-01-30 13:59:31.000000000 +0100
--- src/regexp.c        2013-01-30 18:16:12.000000000 +0100
***************
*** 2397,2409 ****
                            /* '\n' in range: also match NL */
                            if (ret != JUST_CALC_SIZE)
                            {
!                               if (*ret == ANYBUT)
!                                   *ret = ANYBUT + ADD_NL;
!                               else if (*ret == ANYOF)
                                    *ret = ANYOF + ADD_NL;
                                /* else: must have had a \n already */
                            }
-                           *flagp |= HASNL;
                            regparse++;
                            startc = -1;
                        }
--- 2397,2411 ----
                            /* '\n' in range: also match NL */
                            if (ret != JUST_CALC_SIZE)
                            {
!                               /* Using \n inside [^] does not change what
!                                * matches. "[^\n]" is the same as ".". */
!                               if (*ret == ANYOF)
!                               {
                                    *ret = ANYOF + ADD_NL;
+                                   *flagp |= HASNL;
+                               }
                                /* else: must have had a \n already */
                            }
                            regparse++;
                            startc = -1;
                        }
***************
*** 4344,4349 ****
--- 4346,4352 ----
            break; /* Matched with EOW */
  
          case ANY:
+           /* ANY does not match new lines. */
            if (c == NUL)
                status = RA_NOMATCH;
            else
*** ../vim-7.3.795/src/testdir/test79.in        2011-06-19 04:31:54.000000000 
+0200
--- src/testdir/test79.in       2013-01-30 17:56:11.000000000 +0100
***************
*** 201,211 ****
--- 201,215 ----
  /^TEST/
  j:s/A./\=submatch(0)/
  j:s/B./\=submatch(0)/
+ /^Q$
+ :s/Q[^\n]Q/\=submatch(0)."foobar"/
  ENDTEST
  
  TEST_7:
  A
A
  B

-- 
-- 
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.


Raspunde prin e-mail lui