summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/utils.c20
2 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b74208d2d..899ff08e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2015-07-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+ * 35909: Src/utils.c: fix $((...) completion in _expand by
+ normalising quoting of the math expression containing tokens.
+
* 35908: Src/ZLe/zle_tricky.c: fix $((...)) completion
by expand-or-complete widget.
diff --git a/Src/utils.c b/Src/utils.c
index 0acab88ff..f7aaaedf4 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5551,7 +5551,25 @@ quotestring(const char *s, char **e, int instring)
/* Needs to be passed straight through. */
if (dobackslash)
*v++ = '\\';
- *v++ = *u++;
+ if (*u == Inparmath) {
+ /*
+ * Already syntactically quoted: don't
+ * add more.
+ */
+ int inmath = 1;
+ *v++ = *u++;
+ for (;;) {
+ char uc = *u;
+ *v++ = *u++;
+ if (uc == '\0')
+ break;
+ else if (uc == Outparmath && !--inmath)
+ break;
+ else if (uc == Inparmath)
+ ++inmath;
+ }
+ } else
+ *v++ = *u++;
continue;
}