0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.3.014

Problem:    Ending a line in a backslash inside an ":append" or ":insert"
            command in Ex mode doesn't work properly. (Ray Frush)
Solution:   Halve the number of backslashes, only insert a NUL after an odd
            number of backslashes.
This commit is contained in:
Bram Moolenaar 2010-09-29 15:50:30 +02:00
parent f9b5ef8c88
commit 417f5e7f11
2 changed files with 26 additions and 8 deletions

View File

@ -2342,15 +2342,31 @@ redraw:
windgoto(msg_row, msg_col); windgoto(msg_row, msg_col);
pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len; pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
/* we are done when a NL is entered, but not when it comes after a /* We are done when a NL is entered, but not when it comes after an
* backslash */ * odd number of backslashes, that results in a NUL. */
if (line_ga.ga_len > 0 && pend[-1] == '\n' if (line_ga.ga_len > 0 && pend[-1] == '\n')
&& (line_ga.ga_len <= 1 || pend[-2] != '\\'))
{ {
--line_ga.ga_len; int bcount = 0;
--pend;
*pend = NUL; while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
break; ++bcount;
if (bcount > 0)
{
/* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
* "\NL", etc. */
line_ga.ga_len -= (bcount + 1) / 2;
pend -= (bcount + 1) / 2;
pend[-1] = '\n';
}
if ((bcount & 1) == 0)
{
--line_ga.ga_len;
--pend;
*pend = NUL;
break;
}
} }
} }

View File

@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
14,
/**/ /**/
13, 13,
/**/ /**/