]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'master' into next
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 1 Sep 2013 11:35:19 +0000 (13:35 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 1 Sep 2013 11:35:19 +0000 (13:35 +0200)
src/tree.c
testcases/t/145-flattening.t

index 6d23750f8b4604cb65e80da2db0aab6fd9ae1a81..58af674b28fd3e6b0980458ad584eba6115383ed 100644 (file)
@@ -702,6 +702,8 @@ void tree_flatten(Con *con) {
      * the con’s parent to be redundant */
     if (!con_is_split(con) ||
         !con_is_split(child) ||
+        (con->layout != L_SPLITH && con->layout != L_SPLITV) ||
+        (child->layout != L_SPLITH && child->layout != L_SPLITV) ||
         con_orientation(con) == con_orientation(child) ||
         con_orientation(child) != con_orientation(parent))
         goto recurse;
index 33d9f1d155ac72871182477bdebc23783f6d6102..2ccf4539be79f553ef6e8c476ff27c8914a73311 100644 (file)
@@ -38,4 +38,38 @@ my $ws = get_ws($tmp);
 is($ws->{layout}, 'splith', 'workspace layout is splith');
 is(@{$ws->{nodes}}, 3, 'all three windows on workspace level');
 
+################################################################################
+# Ticket #1053 provides a sequence of operations where the flattening does not
+# work correctly:
+################################################################################
+
+$tmp = fresh_workspace;
+
+my $tab1 = open_window;
+my $tab2 = open_window;
+$mid = open_window;
+$right = open_window;
+cmd 'focus right';
+cmd 'split v';
+cmd 'focus right';
+cmd 'move left';
+cmd 'layout tabbed';
+cmd 'focus parent';
+cmd 'split v';
+
+$ws = get_ws($tmp);
+my @nodes = @{$ws->{nodes}};
+is(@nodes, 3, 'all three windows on workspace level');
+is($nodes[0]->{layout}, 'splitv', 'first node is splitv');
+is(@{$nodes[0]->{nodes}}, 1, 'one node in the first node');
+is($nodes[0]->{nodes}->[0]->{layout}, 'tabbed', 'tabbed layout');
+is(@{$nodes[0]->{nodes}->[0]->{nodes}}, 2, 'two nodes in that node');
+
+cmd 'focus right';
+cmd 'move left';
+
+$ws = get_ws($tmp);
+@nodes = @{$ws->{nodes}};
+is(@nodes, 2, 'all three windows on workspace level');
+
 done_testing;