summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index f05259bb9d..51a38e583e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3138,31 +3138,15 @@ redraw:
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 an
- // odd number of backslashes, that results in a NUL.
- if (line_ga.ga_len > 0 && pend[-1] == '\n')
+ // We are done when a NL is entered, but not when it comes after a
+ // backslash in prompt mode.
+ if (line_ga.ga_len > 0 && pend[-1] == '\n'
+ && (line_ga.ga_len <= 1 || pend[-2] != '\\' || !promptc))
{
- 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;
- }
+ --line_ga.ga_len;
+ --pend;
+ *pend = NUL;
+ break;
}
}