[PATCH] Enable escaping double quotes in Executable plug-in
Arkadiusz Drabczyk
arkadiusz at drabczyk.org
Thu Dec 14 18:19:54 UTC 2017
It allows user to do something like this in the scenario:
<executable>emacsclient --eval "(setq unread-command-events (listify-key-sequence \" \"))"</executable>
---
Hello Simon community. I wrote this patch for my own needs and tested
it but it definitely needs more analysis. What do you think?
plugins/Commands/Executable/executablecommand.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugins/Commands/Executable/executablecommand.cpp b/plugins/Commands/Executable/executablecommand.cpp
index c95117b..dc0da8c 100644
--- a/plugins/Commands/Executable/executablecommand.cpp
+++ b/plugins/Commands/Executable/executablecommand.cpp
@@ -79,7 +79,8 @@ bool ExecutableCommand::triggerPrivate(int *state)
com.remove(QRegExp(QLatin1String("\"$")));
realSplitCommand << com;
} else
- if ((com.startsWith('"')) || (com.endsWith('"'))) {
+ if (((com.startsWith('"')) || (com.endsWith('"'))) &&
+ (!com.endsWith("\\\""))) {
com.remove(QRegExp(QLatin1String("^\"")));
com.remove(QRegExp(QLatin1String("\"$")));
@@ -100,6 +101,7 @@ bool ExecutableCommand::triggerPrivate(int *state)
if (realSplitCommand.isEmpty()) continue;
QString realExecutable = realSplitCommand.takeAt(0);
proc.setWorkingDirectory(workingDirectory.path());
+ realSplitCommand.replaceInStrings("\\\"", "\"");
proc.setProgram(realExecutable, realSplitCommand);
proc.startDetached();
}
--
2.9.0
--
Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
More information about the Kde-speech
mailing list