aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim.c5
-rw-r--r--tests/parse.test27
2 files changed, 30 insertions, 2 deletions
diff --git a/jim.c b/jim.c
index d8e0d9c..befdac6 100644
--- a/jim.c
+++ b/jim.c
@@ -1633,8 +1633,11 @@ static int JimEscape(char *dest, const char *s, int slen)
i++;
break;
case '\n':
+ /* Replace all spaces and tabs after backslash newline with a single space*/
*p++ = ' ';
- i++;
+ do {
+ i++;
+ } while (s[i + 1] == ' ' || s[i + 1] == '\t');
break;
case '0':
case '1':
diff --git a/tests/parse.test b/tests/parse.test
index 8422c51..870d4ff 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -227,8 +227,33 @@ test parse-1.45 "spaces before expr function args" {
expr {round (3.2)}
} 3
-test parse-1.45 "expr function missing paren" {
+test parse-1.46 "expr function missing paren" {
catch {expr {round 3.2}}
} 1
+test parse-1.47 "backslash newline in quotes" {
+ # spaces
+ set x "abc\
+ def"
+} "abc def"
+
+test parse-1.48 "backslash newline in quotes" {
+ # tabs
+ set x "abc\
+ def"
+} "abc def"
+
+test parse-1.49 "backslash newline in quotes" {
+ # tabs plus newline
+ set x "abc\
+
+def"
+} "abc \ndef"
+
+test parse-1.50 "backslash newline in quotes" {
+ # tabs plus newline
+ set x "abc\
+def"
+} "abc def"
+
testreport