From 74ab62837fa7ab216a1a342e6610cc574ba91ab9 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 16 Mar 2015 22:13:20 +0100 Subject: [PATCH] Allow to escape escape char to in commands (#191). This patch fixes a misbehaviour in the way the escaping is done for commands given via inputbox or config file. The previous logic for the lhs of a command used '\' to escape the ' '. But to get a single '\' it's needed to use '\\'. But the '\\' was not taken as a single backslash. Now the backslash escapes ' ' as well as '\'. A backslash followed by any other char is taken as is. --- src/ex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ex.c b/src/ex.c index a75ae5c..711190a 100644 --- a/src/ex.c +++ b/src/ex.c @@ -648,8 +648,9 @@ static gboolean parse_lhs(const char **input, ExArg *arg) if (!*input) { /* if input ends here - use only the backslash */ g_string_append_c(arg->lhs, quote); - } else if (**input == ' ') { - /* escaped whitespace becomes only whitespace */ + } else if (**input == ' ' || **input == quote) { + /* Escaped whitespace becomes only whitespace and escaped '\' + * becomes '\' */ g_string_append_c(arg->lhs, **input); } else { /* put escape char and next char into the result string */ -- 2.20.1