]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly return to initial state after prev/next/back_and_forth (Thanks...
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 10 Nov 2011 18:42:24 +0000 (18:42 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 10 Nov 2011 18:42:24 +0000 (18:42 +0000)
Fixes: #552
src/cmdparse.l
testcases/t/179-regress-multiple-ws.t [new file with mode: 0644]

index 6dda34d0ae446078a9c51995f04583cbfdd701b9..9a5b3d7b4f64522b5443c6d8bc966bcf3b22151e 100644 (file)
@@ -74,9 +74,9 @@ EOL (\r?\n)
 
     /* the next/prev/back_and_forth tokens are here to recognize them *before*
      * handling strings ('workspace' command) */
-next                            { return TOK_NEXT; }
-prev                            { return TOK_PREV; }
-back_and_forth                  { return TOK_BACK_AND_FORTH; }
+next                            { BEGIN(INITIAL); return TOK_NEXT; }
+prev                            { BEGIN(INITIAL); return TOK_PREV; }
+back_and_forth                  { BEGIN(INITIAL); return TOK_BACK_AND_FORTH; }
 
 <WANT_STRING>\"[^\"]+\"         {
                                   BEGIN(INITIAL);
diff --git a/testcases/t/179-regress-multiple-ws.t b/testcases/t/179-regress-multiple-ws.t
new file mode 100644 (file)
index 0000000..2127117
--- /dev/null
@@ -0,0 +1,25 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# The command "move workspace prev; workspace prev" will lead to an error.
+# This regression is present in 7f9b65f6a752e454c492447be4e21e2ee8faf8fd
+use i3test;
+
+my $i3 = i3(get_socket_path());
+
+# Open one workspace to move the con to
+my $old = fresh_workspace;
+my $keep_open_con = open_empty_con($i3);
+
+# Get a workspace and open a container
+my $tmp = fresh_workspace;
+my $con = open_empty_con($i3);
+
+is(@{get_ws_content($tmp)}, 1, 'one container');
+is(@{get_ws_content($old)}, 1, 'one container on old ws');
+
+cmd 'move workspace prev; workspace prev';
+
+is(@{get_ws_content($old)}, 2, 'container moved away');
+
+done_testing;