Fixed :qpush and :qunshift without parameters (#52).
authorDaniel Carl <danielcarl@gmx.de>
Tue, 12 Nov 2013 19:28:02 +0000 (20:28 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 12 Nov 2013 19:28:02 +0000 (20:28 +0100)
These commands should use current URI if they where called without any
parameter, but cause of the migration of the way how we parse the inputbox, we
got always a parameter or better right hand side.

src/ex.c

index e771ff2..f1689b9 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -764,7 +764,8 @@ static gboolean ex_open(const ExArg *arg)
 #ifdef FEATURE_QUEUE
 static gboolean ex_queue(const ExArg *arg)
 {
-    Arg a = {.s = arg->rhs->str};
+    Arg a = {0};
+
     switch (arg->code) {
         case EX_QPUSH:
             a.i = COMMAND_QUEUE_PUSH;
@@ -786,6 +787,12 @@ static gboolean ex_queue(const ExArg *arg)
             return false;
     }
 
+    /* if no argument is found in rhs, keep the uri in arg null to force
+     * command_queue() to use current URI */
+    if (arg->rhs->len) {
+        a.s = arg->rhs->str;
+    }
+
     return command_queue(&a);
 }
 #endif