From: Daniel Carl <danielcarl@gmx.de>
Date: Thu, 27 Apr 2017 19:32:48 +0000 (+0200)
Subject: Allow also completion for whitespace prefixed commands.
X-Git-Url: https://git.owens.tech/assets/wrapped.html/assets/wrapped.html/git?a=commitdiff_plain;h=43e4c5876d76b5a3183e25a5b0aa7e9c64899c97;p=vimb.git

Allow also completion for whitespace prefixed commands.

We allow to put whitespace or additional ':' before ex commands to avoid
recoding of the commands in the history. But in the completion only the
first ':' was skipped to get the command to apply completion for.
So ': open foo<Tab>' did not start completion, because ' open' is none
known command.
So skip all ':' and whitespace after the first ':' to set the pointer to
the beginning of the command.
---

diff --git a/src/ex.c b/src/ex.c
index 7b154a5..6ce1ecb 100644
--- a/src/ex.c
+++ b/src/ex.c
@@ -1129,12 +1129,13 @@ static gboolean complete(Client *c, short direction)
     in = (const char*)input;
     if (*in == ':') {
         const char *before_cmdname;
-        /* skipt the first : */
-        in++;
+        /* skip leading ':' and whitespace */
+        while (*in && (*in == ':' || VB_IS_SPACE(*in))) {
+            in++;
+        }
 
         ExArg *arg = g_slice_new0(ExArg);
 
-        skip_whitespace(&in);
         parse_count(&in, arg);
 
         /* Backup the current pointer so that we can restore the input pointer