To: vim-dev@vim.org
Subject: Patch 6.0.124
Fcc: outbox
From: Bram Moolenaar
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 6.0.124
Problem: When using a ":substitute" command that starts with "\="
(evaluated as an expression), "~" was still replaced with the
previous substitute string.
Solution: Skip the replacement when the substitute string starts with "\=".
Also adjust the documentation about doubling backslashes.
Files: src/ex_cmds.c, runtime/doc/change.txt
*** ../vim60.123/src/ex_cmds.c Wed Dec 12 21:42:23 2001
--- src/ex_cmds.c Thu Jan 10 19:27:31 2002
***************
*** 3548,3555 ****
/*
* ~ in the substitute pattern is replaced with the old pattern.
* We do it here once to avoid it to be replaced over and over again.
*/
! sub = regtilde(sub, p_magic);
/*
* Check for a match on each line.
--- 3548,3557 ----
/*
* ~ in the substitute pattern is replaced with the old pattern.
* We do it here once to avoid it to be replaced over and over again.
+ * But don't do it when it starts with "\=", then it's an expression.
*/
! if (!(sub[0] == '\\' && sub[1] == '='))
! sub = regtilde(sub, p_magic);
/*
* Check for a match on each line.
*** ../vim60.123/runtime/doc/change.txt Tue Sep 25 21:40:33 2001
--- runtime/doc/change.txt Thu Jan 10 19:37:10 2002
***************
*** 1,4 ****
! *change.txt* For Vim version 6.0. Last change: 2001 Sep 11
VIM REFERENCE MANUAL by Bram Moolenaar
--- 1,4 ----
! *change.txt* For Vim version 6.0. Last change: 2002 Jan 10
VIM REFERENCE MANUAL by Bram Moolenaar
***************
*** 640,651 ****
*sub-replace-special*
When the {string} starts with "\=" it is evaluated as an expression. The
! special meaning for characters as mentioned below does not apply then.
! The whole matched text can be accessed with "submatch(0)". The text matched
! with the first pair of () with "submatch(1)". Likewise for further
sub-matches in ().
! Be careful: The separation character must not appear in the expression!
! Consider using a character like "@" or "|".
Example: >
:s@\n@\="\r" . expand("$HOME") . "\r"@
This replaces an end-of-line with a new line containing the value of $HOME.
--- 640,655 ----
*sub-replace-special*
When the {string} starts with "\=" it is evaluated as an expression. The
! special meaning for characters as mentioned below does not apply then, except
! "", "\" and "\\". Thus in the result of the expression you need to
! use two backslashes get one, put a backslash before a you want to insert
! and use a without a backslash where you want to break the line.
! The whole matched text can be accessed with "submatch(0)". The text
! matched with the first pair of () with "submatch(1)". Likewise for further
sub-matches in ().
! Be careful: The separation character must not appear in the expression!
! Consider using a character like "@" or "|". There is no problem if the result
! of the expression contains the separation character.
Example: >
:s@\n@\="\r" . expand("$HOME") . "\r"@
This replaces an end-of-line with a new line containing the value of $HOME.
***************
*** 663,671 ****
~ \~ replaced with the {string} of the previous substitute
\~ ~ replaced with ~
\u next character made uppercase
! \U following characters made uppercase
\l next character made lowercase
! \L following characters made lowercase
\e end of \u, \U, \l and \L (NOTE: not !)
\E end of \u, \U, \l and \L
split line in two at this point (Type the as CTRL-V
--- 667,675 ----
~ \~ replaced with the {string} of the previous substitute
\~ ~ replaced with ~
\u next character made uppercase
! \U following characters made uppercase, until \E
\l next character made lowercase
! \L following characters made lowercase, until \E
\e end of \u, \U, \l and \L (NOTE: not !)
\E end of \u, \U, \l and \L
split line in two at this point (Type the as CTRL-V
*** ../vim60.123/src/version.c Wed Jan 9 16:29:27 2002
--- src/version.c Thu Jan 10 19:38:14 2002
***************
*** 608,609 ****
--- 608,611 ----
{ /* Add new patch number below this line */
+ /**/
+ 124,
/**/
--
A M00se once bit my sister ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
\\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///