From: Michael Stapelberg Date: Tue, 24 Mar 2015 08:27:42 +0000 (+0100) Subject: Revert "Workspace command number selection" X-Git-Tag: 4.10.1~29 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=822cd3bf1b95a61667bfa186ff2093ecd317a3a6;p=i3%2Fi3 Revert "Workspace command number selection" This reverts commit cbd51ce6642be4e1163a64dce8ec20a454f1bf05. If you’ve started using this feature, I’m very sorry, but I think it’s better to revert it entirely, as it will only cause more problems in the future as more and more people upgrade and get bitten by this if we didn’t revert it… fixes #1536 --- diff --git a/src/commands.c b/src/commands.c index 80f57b81..9b51b3ec 100644 --- a/src/commands.c +++ b/src/commands.c @@ -494,27 +494,7 @@ void cmd_move_con_to_workspace_name(I3_CMD, char *name) { LOG("should move window to workspace %s\n", name); /* get the workspace */ - Con *ws = NULL; - Con *output = NULL; - - /* first look for a workspace with this name */ - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), !strcasecmp(child->name, name)); - } - - /* if the name is plain digits, we interpret this as a "workspace number" - * command */ - if (!ws && name_is_digits(name)) { - long parsed_num = ws_name_to_number(name); - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), - child->num == parsed_num); - } - } - - /* if no workspace was found, make a new one */ - if (!ws) - ws = workspace_get(name, NULL); + Con *ws = workspace_get(name, NULL); ws = maybe_auto_back_and_forth_workspace(ws); @@ -1049,30 +1029,7 @@ void cmd_workspace_name(I3_CMD, char *name) { DLOG("should switch to workspace %s\n", name); if (maybe_back_and_forth(cmd_output, name)) return; - - Con *ws = NULL; - Con *output = NULL; - - /* first look for a workspace with this name */ - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), !strcasecmp(child->name, name)); - } - - /* if the name is only digits, we interpret this as a "workspace number" - * command */ - if (!ws && name_is_digits(name)) { - long parsed_num = ws_name_to_number(name); - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), - child->num == parsed_num); - } - } - - /* if no workspace was found, make a new one */ - if (!ws) - ws = workspace_get(name, NULL); - - workspace_show(ws); + workspace_show_by_name(name); cmd_output->needs_tree_render = true; // XXX: default reply for now, make this a better reply diff --git a/testcases/t/232-cmd-workspace-number-selection.t b/testcases/t/232-cmd-workspace-number-selection.t deleted file mode 100644 index bda05643..00000000 --- a/testcases/t/232-cmd-workspace-number-selection.t +++ /dev/null @@ -1,52 +0,0 @@ -#!perl -# vim:ts=4:sw=4:expandtab -# -# Please read the following documents before working on tests: -# • http://build.i3wm.org/docs/testsuite.html -# (or docs/testsuite) -# -# • http://build.i3wm.org/docs/lib-i3test.html -# (alternatively: perldoc ./testcases/lib/i3test.pm) -# -# • http://build.i3wm.org/docs/ipc.html -# (or docs/ipc) -# -# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf -# (unless you are already familiar with Perl) -# -# Test that `workspace {N}` acts like `workspace number {N}` when N is a plain -# digit, and likewise for `move to workspace {N}`. -# Ticket: #1238 -# Bug still in: 4.8-16-g3f5a0f0 -use i3test; - -cmd 'workspace 5:foo'; -open_window; -fresh_workspace; -cmd 'workspace 5'; - -is(focused_ws, '5:foo', - 'a command to switch to a workspace with a bare number should switch to a workspace of that number'); - -fresh_workspace; -my $win = open_window; -cmd '[id="' . $win->{id} . '"] move to workspace 5'; - -is(@{get_ws('5:foo')->{nodes}}, 2, - 'a command to move a container to a workspace with a bare number should move that container to a workspace of that number'); - -fresh_workspace; -cmd 'workspace 7'; -open_window; -cmd 'workspace 7:foo'; -$win = open_window; - -cmd 'workspace 7'; -is(focused_ws, '7', - 'a workspace with a name that is a matching plain number should be preferred when switching'); - -cmd '[id="' . $win->{id} . '"] move to workspace 7'; -is(@{get_ws('7')->{nodes}}, 2, - 'a workspace with a name that is a matching plain number should be preferred when moving'); - -done_testing;