Skip to content

Commit

Permalink
updated for version 7.3.014
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed Sep 29, 2010
1 parent 9b3ee03 commit 2e002ed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/ex_getln.c
Expand Up @@ -2342,15 +2342,31 @@ getexmodeline(promptc, cookie, indent)
windgoto(msg_row, msg_col);
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
* backslash */
if (line_ga.ga_len > 0 && pend[-1] == '\n'
&& (line_ga.ga_len <= 1 || pend[-2] != '\\'))
/* We are done when a NL is entered, but not when it comes after an
* odd number of backslashes, that results in a NUL. */
if (line_ga.ga_len > 0 && pend[-1] == '\n')
{
--line_ga.ga_len;
--pend;
*pend = NUL;
break;
int bcount = 0;

while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
++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;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -714,6 +714,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
14,
/**/
13,
/**/
Expand Down

0 comments on commit 2e002ed

Please sign in to comment.