commands.c: Improve error replies

- Improve / add various error messages.
- Replace all `LOG(…); ysuccess(false);` with `yerror(…);`.
- switch_mode: Remove redundant "ERROR:" ELOG string.
- cmd_move_con_to_workspace*: Make sure that we don't try to move an
empty workspace to another workspace. This can be problematic when we
match a workspace using command criteria (eg marks) and the target is a
non-existing workspace. We create the new workspace but since nothing is
moved there, we are left with an empty workspace. See added testcase.
This commit is contained in:
Orestis Floros
2018-09-11 07:44:40 +03:00
parent 83327abae4
commit e67be1ccd3
3 changed files with 82 additions and 99 deletions

View File

@ -339,4 +339,15 @@ $ws = get_ws($tmp2);
is_num_children($tmp2, 0, 'no regular nodes on second workspace');
is(@{$ws->{floating_nodes}}, 1, 'one floating node on second workspace');
###################################################################
# Check that moving an empty workspace using criteria doesn't
# create unfocused empty workspace.
###################################################################
$tmp2 = get_unused_workspace();
$tmp = fresh_workspace();
cmd 'mark a';
cmd "[con_mark=a] move to workspace $tmp2";
is (get_ws($tmp2), undef, 'No empty workspace created');
done_testing;