aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-03-12 13:00:37 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-03-12 13:00:37 -0700
commit3b00d06a62ead75883873068e2cb9754290f2e40 (patch)
treeaa78b59e13c610da5eee8b744b26c5ef04975675 /reader.cpp
parent234fb7c2fec7e78f1236316cf77dc16750c9cfc3 (diff)
Return key should only insert a newline if backslashed character is whitespace, or backslash terminates the line
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/reader.cpp b/reader.cpp
index 00f99c8d..3ba5e84e 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -3247,13 +3247,14 @@ const wchar_t *reader_readline()
/* Delete any autosuggestion */
data->autosuggestion.clear();
- /*
- Allow backslash-escaped newlines
- */
+ /* Allow backslash-escaped newlines, but only if the following character is whitespace, or we're at the end of the text (see issue #163) */
if (is_backslashed(data->command_line, data->buff_pos))
{
- insert_char('\n');
- break;
+ if (data->buff_pos >= data->command_length() || iswspace(data->command_line.at(data->buff_pos)))
+ {
+ insert_char('\n');
+ break;
+ }
}
switch (data->test_func(data->command_line.c_str()))