]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Properly parse commands like “move workspace torrent” (Thanks rasi)
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 18 Feb 2013 23:27:55 +0000 (00:27 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 18 Feb 2013 23:27:55 +0000 (00:27 +0100)
fixes #955

generate-command-parser.pl
parser-specs/commands.spec
testcases/t/187-commands-parser.t

index 5cdebf343c9dcb9794fd2c8e7930435ca3fc6dc7..b76d5e5512f8215ffec637103c8c9686c7dc97ef 100755 (executable)
@@ -84,14 +84,14 @@ for my $line (@lines) {
         # Cleanup the identifier (if any).
         $identifier =~ s/^\s*(\S+)\s*=\s*$/$1/g;
 
         # Cleanup the identifier (if any).
         $identifier =~ s/^\s*(\S+)\s*=\s*$/$1/g;
 
-        # Cleanup the tokens (remove whitespace).
-        $tokens =~ s/\s*//g;
-
         # The default action is to stay in the current state.
         $action = $current_state if length($action) == 0;
 
         #say "identifier = *$identifier*, token = *$tokens*, action = *$action*";
         for my $token (split(',', $tokens)) {
         # The default action is to stay in the current state.
         $action = $current_state if length($action) == 0;
 
         #say "identifier = *$identifier*, token = *$tokens*, action = *$action*";
         for my $token (split(',', $tokens)) {
+            # Cleanup trailing/leading whitespace.
+            $token =~ s/^\s*//g;
+            $token =~ s/\s*$//g;
             my $store_token = {
                 token => $token,
                 identifier => $identifier,
             my $store_token = {
                 token => $token,
                 identifier => $identifier,
index 740c83acef13a50e0d32a0b9f55f4934cd6c7acb..a4a01a88d0668385bb5c154d4c058b016771953a 100644 (file)
@@ -262,7 +262,7 @@ state MOVE_DIRECTION_PX:
       -> call cmd_move_direction($direction, $pixels)
 
 state MOVE_WORKSPACE:
       -> call cmd_move_direction($direction, $pixels)
 
 state MOVE_WORKSPACE:
-  'to'
+  'to '
       -> MOVE_WORKSPACE_TO_OUTPUT
   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
       -> call cmd_move_con_to_workspace($workspace)
       -> MOVE_WORKSPACE_TO_OUTPUT
   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
       -> call cmd_move_con_to_workspace($workspace)
index 37deb94256e7708556d03cb676593fdf49245b37..52070d56b1090b55b31e4d87b11dcf7e21767bab 100644 (file)
@@ -52,6 +52,8 @@ is(parser_calls(
    'move window to workspace 3; ' .
    'move container to workspace 3; ' .
    'move workspace foobar; ' .
    'move window to workspace 3; ' .
    'move container to workspace 3; ' .
    'move workspace foobar; ' .
+   'move workspace torrent; ' .
+   'move workspace to output LVDS1; ' .
    'move workspace 3: foobar; ' .
    'move workspace "3: foobar"; ' .
    'move workspace "3: foobar, baz"; '),
    'move workspace 3: foobar; ' .
    'move workspace "3: foobar"; ' .
    'move workspace "3: foobar, baz"; '),
@@ -59,6 +61,8 @@ is(parser_calls(
    "cmd_move_con_to_workspace_name(3)\n" .
    "cmd_move_con_to_workspace_name(3)\n" .
    "cmd_move_con_to_workspace_name(foobar)\n" .
    "cmd_move_con_to_workspace_name(3)\n" .
    "cmd_move_con_to_workspace_name(3)\n" .
    "cmd_move_con_to_workspace_name(foobar)\n" .
+   "cmd_move_con_to_workspace_name(torrent)\n" .
+   "cmd_move_workspace_to_output(LVDS1)\n" .
    "cmd_move_con_to_workspace_name(3: foobar)\n" .
    "cmd_move_con_to_workspace_name(3: foobar)\n" .
    "cmd_move_con_to_workspace_name(3: foobar, baz)",
    "cmd_move_con_to_workspace_name(3: foobar)\n" .
    "cmd_move_con_to_workspace_name(3: foobar)\n" .
    "cmd_move_con_to_workspace_name(3: foobar, baz)",