From dd8079e0415cf213d9bb5d41d1ad95c04b774f3a Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Sat, 25 Jul 2015 21:36:54 +0100
Subject: 35809: fix $((...)) completion by _expand widget.
This changes internal quoting of the form still including tokens
not to add unnecessary internal backslashes.
---
Src/utils.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
(limited to 'Src')
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;
}
--
cgit 1.4.1