From 43e4c5876d76b5a3183e25a5b0aa7e9c64899c97 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Thu, 27 Apr 2017 21:32:48 +0200
Subject: [PATCH] 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.
---
 src/ex.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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