Allow also completion for whitespace prefixed commands.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 27 Apr 2017 19:32:48 +0000 (21:32 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 27 Apr 2017 20:12:59 +0000 (22:12 +0200)
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

index 7b154a5..6ce1ecb 100644 (file)
--- 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