From a038d2674bed411e7e1867c1a4957d8b9734f3a6 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 3 Mar 2011 14:30:13 +0100 Subject: [PATCH] Bugfix: 'level up' needs to stop at the workspace con + testcase (Thanks mseed) --- src/tree.c | 5 +++-- testcases/t/52-regress-level-up.t | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 testcases/t/52-regress-level-up.t diff --git a/src/tree.c b/src/tree.c index 31177109..3c209fbc 100644 --- a/src/tree.c +++ b/src/tree.c @@ -268,8 +268,9 @@ void tree_split(Con *con, orientation_t orientation) { */ void level_up() { /* We can focus up to the workspace, but not any higher in the tree */ - if (focused->parent->type != CT_CON && - focused->parent->type != CT_WORKSPACE) { + if ((focused->parent->type != CT_CON && + focused->parent->type != CT_WORKSPACE) || + focused->type == CT_WORKSPACE) { printf("cannot go up\n"); return; } diff --git a/testcases/t/52-regress-level-up.t b/testcases/t/52-regress-level-up.t new file mode 100644 index 00000000..19b0f85d --- /dev/null +++ b/testcases/t/52-regress-level-up.t @@ -0,0 +1,21 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Regression test for using level-up to get to the 'content'-container and +# toggle floating +# +use Time::HiRes qw(sleep); +use i3test; + +my $tmp = get_unused_workspace; +cmd "workspace $tmp"; + + +cmd 'open'; +cmd 'level up'; +cmd 'level up'; +cmd 'mode toggle'; + +does_i3_live; + +done_testing; -- 2.39.5