From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 16 Mar 2015 21:13:20 +0000 (+0100)
Subject: Allow to escape escape char to in commands (#191).
X-Git-Url: https://git.owens.tech/dummy.html/dummy.html/git?a=commitdiff_plain;h=74ab62837fa7ab216a1a342e6610cc574ba91ab9;p=vimb.git

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.
---

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 */