Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-24 Fir de Conversatie Motoya Kurotsu
Hi,

I attach a patch (against svn revision 1889) and four test
files. Some test patterns are recognized as binary by diff.
So I attached them separately.

The following is a brief explanation of this patch.
==

Since the patch 7.2.407 was applied, the backslash in the
expression is not consumed but kept. For example, \CR
in the expression results in a backslash followed by a line
break and two backslashes \\ in the expression results in
two backslashes. See *sub-replace-expression*.

Since the patch 7.2.407 and 7.2.437 was applied, \NL in
the expression results in not real NL character but a
backslash followed by a line break. See
*sub-replace-expression*.

The description about the notation '\=' used in the third
argument of substitute() is added. See
*sub-replace-expression*.

The description about the special characters used in the
third argument of substitute() is added. See
*sub-replace-special*.

The description about % used in the third argument of
substitute() is added. See *:s%*.

The description about submatch() used in substitute() is
added. See *submatch()*.

Regards,

Motoya Kurotsu

2011/3/20 Motoya Kurotsu motoya.kuro...@gmail.com:
 Hi,

 Thank for the patch.  How about adding a test?

 I would post the patch as soon as possible.

 Motoya Kurotsu

 2011/3/18 Bram Moolenaar b...@moolenaar.net:

 Motoya Kurotsu wrote:

 The patch is attached. Please check and correct.

 I deleted the following expression in
 *sub-replace-expression* because the function has been lost
 since Patch 7.2.437.

  Prepend a backslash to get a real NL character (which will be
  a NUL in the file).

 I added the description that \= notation is valid in not only
 :substitute command but also substitute() function.

 I also added the description that submatch() is valid in not only
 :substitute command but also substitute() function because the
 code seems to work so. I'm not sure why :help submatch() insists
 on Only for an expression in a :substitute command. Since the
 introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
 it seems to have worked with the first level substitute() such like
 the following.

 let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

 Thank for the patch.  How about adding a test?

 --
 Citizens are not allowed to attend a movie house or theater nor ride in a
 public streetcar within at least four hours after eating garlic.
                [real standing law in Indiana, United States of America]

  /// Bram Moolenaar -- b...@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    ///

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


test71.in
Description: Binary data


test72.in
Description: Binary data


test71.ok
Description: Binary data


test72.ok
Description: Binary data


regexp.c.patch
Description: Binary data


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-19 Fir de Conversatie Motoya Kurotsu
Hi,

 Thank for the patch.  How about adding a test?

I would post the patch as soon as possible.

Motoya Kurotsu

2011/3/18 Bram Moolenaar b...@moolenaar.net:

 Motoya Kurotsu wrote:

 The patch is attached. Please check and correct.

 I deleted the following expression in
 *sub-replace-expression* because the function has been lost
 since Patch 7.2.437.

  Prepend a backslash to get a real NL character (which will be
  a NUL in the file).

 I added the description that \= notation is valid in not only
 :substitute command but also substitute() function.

 I also added the description that submatch() is valid in not only
 :substitute command but also substitute() function because the
 code seems to work so. I'm not sure why :help submatch() insists
 on Only for an expression in a :substitute command. Since the
 introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
 it seems to have worked with the first level substitute() such like
 the following.

 let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

 Thank for the patch.  How about adding a test?

 --
 Citizens are not allowed to attend a movie house or theater nor ride in a
 public streetcar within at least four hours after eating garlic.
                [real standing law in Indiana, United States of America]

  /// Bram Moolenaar -- b...@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    ///

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


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-18 Fir de Conversatie Bram Moolenaar

Motoya Kurotsu wrote:

 The patch is attached. Please check and correct.
 
 I deleted the following expression in
 *sub-replace-expression* because the function has been lost
 since Patch 7.2.437.
 
  Prepend a backslash to get a real NL character (which will be
  a NUL in the file).
 
 I added the description that \= notation is valid in not only
 :substitute command but also substitute() function.
 
 I also added the description that submatch() is valid in not only
 :substitute command but also substitute() function because the
 code seems to work so. I'm not sure why :help submatch() insists
 on Only for an expression in a :substitute command. Since the
 introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
 it seems to have worked with the first level substitute() such like
 the following.
 
 let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

Thank for the patch.  How about adding a test?

-- 
Citizens are not allowed to attend a movie house or theater nor ride in a
public streetcar within at least four hours after eating garlic.
[real standing law in Indiana, United States of America]

 /// Bram Moolenaar -- b...@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///

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


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-16 Fir de Conversatie motz
Hi,

The patch is attached. Please check and correct.

I deleted the following expression in
*sub-replace-expression* because the function has been lost
since Patch 7.2.437.

 Prepend a backslash to get a real NL character (which will be
 a NUL in the file).

I added the description that \= notation is valid in not only
:substitute command but also substitute() function.

I also added the description that submatch() is valid in not only
:substitute command but also substitute() function because the
code seems to work so. I'm not sure why :help submatch() insists
on Only for an expression in a :substitute command. Since the
introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
it seems to have worked with the first level substitute() such like
the following.

let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

Regards,

Motoya Kurotsu

== attachment =
diff -Nur vim73.orig/runtime/doc/change.txt vim73/runtime/doc/
change.txt
--- vim73.orig/runtime/doc/change.txt   2010-08-15 21:23:19.0
+0900
+++ vim73/runtime/doc/change.txt2011-03-16 13:30:57.0
+0900
@@ -793,10 +793,11 @@
 not apply except for CR, \CR and \\.  Thus in the result of
the
 expression you need to use two backslashes to get one, put a
backslash before a
 CR you want to insert, and use a CR without a backslash where you
want to
-break the line.
+break the line. For convenience a NL character is also used as a
line break.

-For convenience a NL character is also used as a line break.
Prepend a
-backslash to get a real NL character (which will be a NUL in the
file).
+The notation \= is valid inside the third argument of substitute()
+function.  In this case, the special meaning for characters as
mentioned
+at |sub-replace-special| does not apply at all.

 When the result is a |List| then the items are joined with separating
line
 breaks.  Thus each item becomes a line, except that they can contain
line
diff -Nur vim73.orig/runtime/doc/eval.txt vim73/runtime/doc/eval.txt
--- vim73.orig/runtime/doc/eval.txt 2010-08-15 21:23:20.0
+0900
+++ vim73/runtime/doc/eval.txt  2011-03-16 14:49:22.0 +0900
@@ -5507,9 +5507,10 @@
Also see |strlen()|, |strdisplaywidth()| and |
strchars()|.

 submatch({nr}) *submatch()*
-   Only for an expression in a |:substitute| command.
Returns
-   the {nr}'th submatch of the matched text.  When {nr}
is 0
-   the whole matched text is returned.
+   This is used in the expression for |:substitute|
command or
+|substitute()| function. See also |sub-replace-
expression|.
+This returns the {nr}'th submatch of the matched
text.  When
+{nr} is 0 the whole matched text is returned.
Example: 
:s/\d\+/\=submatch(0) + 1/
   This finds the first number in the line and adds one
to it.
@@ -5526,7 +5527,9 @@
And a ~ in {sub} is not replaced with the previous
{sub}.
Note that some codes in {sub} have a special meaning
|sub-replace-special|.  For example, to replace
something with
-   \n (two characters), use n or '\\n'.
+   \n (two characters), use n or '\\n'. When
{sub} starts
+with \=, the remainder is interpreted as an
expression. This
+does not work recursively. See |sub-replace-
expression|.
When {pat} does not match in {expr}, {expr} is
returned
unmodified.
When {flags} is g, all matches of {pat} in {expr}
are
diff -Nur vim73.orig/src/regexp.c vim73/src/regexp.c
--- vim73.orig/src/regexp.c 2011-03-06 16:45:15.0 +0900
+++ vim73/src/regexp.c  2011-03-16 13:18:11.0 +0900
@@ -6872,6 +6872,7 @@
 static regmmatch_T *submatch_mmatch;
 static linenr_Tsubmatch_firstlnum;
 static linenr_Tsubmatch_maxline;
+static int submatch_line_lbr;
 #endif

 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) ||
defined(PROTO)
@@ -6998,6 +6999,7 @@
submatch_mmatch = reg_mmatch;
submatch_firstlnum = reg_firstlnum;
submatch_maxline = reg_maxline;
+   submatch_line_lbr = reg_line_lbr;
save_reg_win = reg_win;
save_ireg_ic = ireg_ic;
can_f_submatch = TRUE;
@@ -7011,7 +7013,7 @@
{
/* Change NL to CR, so that it becomes a line
break.
 * Skip over a backslashed character. */
-   if (*s == NL)
+   if (*s == NL  !submatch_line_lbr)
*s = CAR;
else if (*s == '\\'  s[1] != NUL)
{
@@ -7021,7 +7023,7 @@
 *   abc\
 *   def
 */
-   

Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-16 Fir de Conversatie motz
Hi,

The patch is attached. Please check and correct.

I deleted the following expression in
*sub-replace-expression* because the function has been lost
since Patch 7.2.437.

 Prepend a backslash to get a real NL character (which will be
 a NUL in the file).

I added the description that \= notation is valid in not only
:substitute command but also substitute() function.

I also added the description that submatch() is valid in not only
:substitute command but also substitute() function because the
code seems to work so. I'm not sure why :help submatch() insists
on Only for an expression in a :substitute command. Since the
introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
it seems to have worked with the first level substitute() such like
the following.

let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

Regards,

Motoya Kurotsu

== attachment =
diff -Nur vim73.orig/runtime/doc/change.txt vim73/runtime/doc/
change.txt
--- vim73.orig/runtime/doc/change.txt   2010-08-15 21:23:19.0
+0900
+++ vim73/runtime/doc/change.txt2011-03-16 13:30:57.0
+0900
@@ -793,10 +793,11 @@
 not apply except for CR, \CR and \\.  Thus in the result of
the
 expression you need to use two backslashes to get one, put a
backslash before a
 CR you want to insert, and use a CR without a backslash where you
want to
-break the line.
+break the line. For convenience a NL character is also used as a
line break.

-For convenience a NL character is also used as a line break.
Prepend a
-backslash to get a real NL character (which will be a NUL in the
file).
+The notation \= is valid inside the third argument of substitute()
+function.  In this case, the special meaning for characters as
mentioned
+at |sub-replace-special| does not apply at all.

 When the result is a |List| then the items are joined with separating
line
 breaks.  Thus each item becomes a line, except that they can contain
line
diff -Nur vim73.orig/runtime/doc/eval.txt vim73/runtime/doc/eval.txt
--- vim73.orig/runtime/doc/eval.txt 2010-08-15 21:23:20.0
+0900
+++ vim73/runtime/doc/eval.txt  2011-03-16 14:49:22.0 +0900
@@ -5507,9 +5507,10 @@
Also see |strlen()|, |strdisplaywidth()| and |
strchars()|.

 submatch({nr}) *submatch()*
-   Only for an expression in a |:substitute| command.
Returns
-   the {nr}'th submatch of the matched text.  When {nr}
is 0
-   the whole matched text is returned.
+   This is used in the expression for |:substitute|
command or
+|substitute()| function. See also |sub-replace-
expression|.
+This returns the {nr}'th submatch of the matched
text.  When
+{nr} is 0 the whole matched text is returned.
Example: 
:s/\d\+/\=submatch(0) + 1/
   This finds the first number in the line and adds one
to it.
@@ -5526,7 +5527,9 @@
And a ~ in {sub} is not replaced with the previous
{sub}.
Note that some codes in {sub} have a special meaning
|sub-replace-special|.  For example, to replace
something with
-   \n (two characters), use n or '\\n'.
+   \n (two characters), use n or '\\n'. When
{sub} starts
+with \=, the remainder is interpreted as an
expression. This
+does not work recursively. See |sub-replace-
expression|.
When {pat} does not match in {expr}, {expr} is
returned
unmodified.
When {flags} is g, all matches of {pat} in {expr}
are
diff -Nur vim73.orig/src/regexp.c vim73/src/regexp.c
--- vim73.orig/src/regexp.c 2011-03-06 16:45:15.0 +0900
+++ vim73/src/regexp.c  2011-03-16 13:18:11.0 +0900
@@ -6872,6 +6872,7 @@
 static regmmatch_T *submatch_mmatch;
 static linenr_Tsubmatch_firstlnum;
 static linenr_Tsubmatch_maxline;
+static int submatch_line_lbr;
 #endif

 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) ||
defined(PROTO)
@@ -6998,6 +6999,7 @@
submatch_mmatch = reg_mmatch;
submatch_firstlnum = reg_firstlnum;
submatch_maxline = reg_maxline;
+   submatch_line_lbr = reg_line_lbr;
save_reg_win = reg_win;
save_ireg_ic = ireg_ic;
can_f_submatch = TRUE;
@@ -7011,7 +7013,7 @@
{
/* Change NL to CR, so that it becomes a line
break.
 * Skip over a backslashed character. */
-   if (*s == NL)
+   if (*s == NL  !submatch_line_lbr)
*s = CAR;
else if (*s == '\\'  s[1] != NUL)
{
@@ -7021,7 +7023,7 @@
 *   abc\
 *   def
 */
-   

Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-16 Fir de Conversatie motz
Please ignore this reply, sorry.

On 3月14日, 午前8:42, motz motoya.kuro...@gmail.com wrote:
 Hi,

 I would. But English is not my native language. So I hope that
 someone would check and correct.

 In Japan or at Tokyo, the periodical blackout is planned from
 the effect of the earthquake. So it may take a while to post the
 patch. But I would do so as possible as I can.

 Regards,

 Motoya Kurotsu

 On 3月12日, 午前4:34, Bram Moolenaar b...@moolenaar.net wrote:

  Ben Schmidt wrote:
I would like to propose a patch which suppresses the conversion of
NL  toCR  when evaluaation ('\=') is used inside substitute()
function.
Simply this patch is what makes x == y true in the following code.

  let x = substitute('a', '.', \n, )
  let y = substitute('a', '.', '\=\n', )

   Regardless of whether the functionality change of the patch is accepted,
   I think there should be a change to :help sub-replace-expression to
   explain what is done when \= is used within substitute().

  Can someone propose a patch?

  --
  Why isn't there mouse-flavored cat food?

   /// Bram Moolenaar -- b...@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  ///

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


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-16 Fir de Conversatie Motoya Kurotsu
Hi,

The patch is attached. Please check and correct.

I deleted the following expression in
*sub-replace-expression* because the function has been lost
since Patch 7.2.437.

 Prepend a backslash to get a real NL character (which will be
 a NUL in the file).

I added the description that \= notation is valid in not only
:substitute command but also substitute() function.

I also added the description that submatch() is valid in not only
:substitute command but also substitute() function because the
code seems to work so. I'm not sure why :help submatch() insists
on Only for an expression in a :substitute command. Since the
introduction of submatch() in eval.c (vim-6.0d or CVS revision 1.12),
it seems to have worked with the first level substitute() such like
the following.

let y = substitute(hello, '\l', '\=toupper(submatch(0)), g)

Regards,

Motoya Kurotsu

2011/3/17 motz motoya.kuro...@gmail.com:
 Please ignore this reply, sorry.

 On 3月14日, 午前8:42, motz motoya.kuro...@gmail.com wrote:
 Hi,

 I would. But English is not my native language. So I hope that
 someone would check and correct.

 In Japan or at Tokyo, the periodical blackout is planned from
 the effect of the earthquake. So it may take a while to post the
 patch. But I would do so as possible as I can.

 Regards,

 Motoya Kurotsu

 On 3月12日, 午前4:34, Bram Moolenaar b...@moolenaar.net wrote:

  Ben Schmidt wrote:
I would like to propose a patch which suppresses the conversion of
NL  toCR  when evaluaation ('\=') is used inside substitute()
function.
Simply this patch is what makes x == y true in the following code.

  let x = substitute('a', '.', \n, )
  let y = substitute('a', '.', '\=\n', )

   Regardless of whether the functionality change of the patch is accepted,
   I think there should be a change to :help sub-replace-expression to
   explain what is done when \= is used within substitute().

  Can someone propose a patch?

  --
  Why isn't there mouse-flavored cat food?

   /// Bram Moolenaar -- b...@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  ///

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


regexp.c.patch
Description: Binary data


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-13 Fir de Conversatie motz
Hi,

I would. But English is not my native language. So I hope that
someone would check and correct.

In Japan or at Tokyo, the periodical blackout is planned from
the effect of the earthquake. So it may take a while to post the
patch. But I would do so as possible as I can.

Regards,

Motoya Kurotsu


On 3月12日, 午前4:34, Bram Moolenaar b...@moolenaar.net wrote:
 Ben Schmidt wrote:
   I would like to propose a patch which suppresses the conversion of
   NL  toCR  when evaluaation ('\=') is used inside substitute()
   function.
   Simply this patch is what makes x == y true in the following code.

     let x = substitute('a', '.', \n, )
     let y = substitute('a', '.', '\=\n', )

  Regardless of whether the functionality change of the patch is accepted,
  I think there should be a change to :help sub-replace-expression to
  explain what is done when \= is used within substitute().

 Can someone propose a patch?

 --
 Why isn't there mouse-flavored cat food?

  /// Bram Moolenaar -- b...@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   ///

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


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-11 Fir de Conversatie Bram Moolenaar

Ben Schmidt wrote:

  I would like to propose a patch which suppresses the conversion of
  NL  toCR  when evaluaation ('\=') is used inside substitute()
  function.
  Simply this patch is what makes x == y true in the following code.
 
let x = substitute('a', '.', \n, )
let y = substitute('a', '.', '\=\n', )
 
 Regardless of whether the functionality change of the patch is accepted,
 I think there should be a change to :help sub-replace-expression to
 explain what is done when \= is used within substitute().

Can someone propose a patch?

-- 
Why isn't there mouse-flavored cat food?

 /// Bram Moolenaar -- b...@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///

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


Re: Proposed patch: NL in sub-replace-expression('\=')

2011-03-09 Fir de Conversatie Ben Schmidt

I would like to propose a patch which suppresses the conversion of
NL  toCR  when evaluaation ('\=') is used inside substitute()
function.
Simply this patch is what makes x == y true in the following code.

  let x = substitute('a', '.', \n, )
  let y = substitute('a', '.', '\=\n', )


Regardless of whether the functionality change of the patch is accepted,
I think there should be a change to :help sub-replace-expression to
explain what is done when \= is used within substitute().

Ben.



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


Proposed patch: NL in sub-replace-expression('\=')

2011-03-08 Fir de Conversatie motz
Hi,

I would like to propose a patch which suppresses the conversion of
NL to CR when evaluaation ('\=') is used inside substitute()
function.
Simply this patch is what makes x == y true in the following code.

 let x = substitute('a', '.', \n, )
 let y = substitute('a', '.', '\=\n', )

The current implementation forces the conversion without regard to the
kind of target, buffer or string. Actually we don't have any way to
replace something with the string containing \n with use of
evaluation
('\=') used inside substitute() function.

By this patch, for example, the following code works as we expect.

 let s:table = {'\\':'\', '\r':\r, '\n':\n }
 let s:str = '\\\r\n'
 let s:rep = substitute(s:str, '\|\\r\|\\n',
'\=s:table[submatch(0)]', 'g')

And this patch does not affect to the result of :substitute
command. Simply, the conversion of NL to CR is done as it has
been.

In addition, this patch copes with the recursive call of substitute.
Any
combination of :substitute command and substitute() function works.
However
the use of evaluation ('\=') should be limited once as it has been.

The key is the use of the static variable reg_line_lbr in regexp.c.
This variable is true if \n in string is line break according to the
comment it regexp.c. Actually, the current implementation set true if
the target is buffer, vice versa if the target is string.
Just to make sure, refer to the use of vim_regexec_multi() in do_sub()
and the use of vim_regsub() in do_string_sub().

This issue has been discussed on the thread of vim_use group;

http://groups.google.com/group/vim_use/browse_thread/thread/5b94dab308193660

Please refer to it, either if you have not.

Regards,

Motoya Kurotsu

=== attachment ==

--- vim73/src/regexp.c  2011-03-06 16:45:15.0 +0900
+++ vim73.1/src/regexp.c2011-03-09 10:36:09.0 +0900
@@ -6872,6 +6872,7 @@
 static regmmatch_T *submatch_mmatch;
 static linenr_Tsubmatch_firstlnum;
 static linenr_Tsubmatch_maxline;
+static int submatch_line_lbr;
 #endif

 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) ||
defined(PROTO)
@@ -6998,6 +6999,7 @@
submatch_mmatch = reg_mmatch;
submatch_firstlnum = reg_firstlnum;
submatch_maxline = reg_maxline;
+   submatch_line_lbr = reg_line_lbr;
save_reg_win = reg_win;
save_ireg_ic = ireg_ic;
can_f_submatch = TRUE;
@@ -7009,9 +7011,10 @@

for (s = eval_result; *s != NUL; mb_ptr_adv(s))
{
-   /* Change NL to CR, so that it becomes a line
break.
+   /* When NL means a line break, change NL to CR,
+* so that it becomes a line break.
 * Skip over a backslashed character. */
-   if (*s == NL)
+   if (*s == NL  !submatch_line_lbr)
*s = CAR;
else if (*s == '\\'  s[1] != NUL)
{
@@ -7021,7 +7024,7 @@
 *   abc\
 *   def
 */
-   if (*s == NL)
+   if (*s == NL  !submatch_line_lbr)
*s = CAR;
had_backslash = TRUE;
}
@@ -7044,6 +7047,7 @@
reg_mmatch = submatch_mmatch;
reg_firstlnum = submatch_firstlnum;
reg_maxline = submatch_maxline;
+   reg_line_lbr = submatch_line_lbr;
reg_win = save_reg_win;
ireg_ic = save_ireg_ic;
can_f_submatch = FALSE;

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