Merge branch 'fix-split'

This commit is contained in:
Michael Stapelberg 2012-02-07 17:42:41 -05:00
commit 1ddde16895
2 changed files with 23 additions and 1 deletions

View File

@ -291,7 +291,8 @@ void tree_split(Con *con, orientation_t orientation) {
/* if we are in a container whose parent contains only one /* if we are in a container whose parent contains only one
* child (its split functionality is unused so far), we just change the * child (its split functionality is unused so far), we just change the
* orientation (more intuitive than splitting again) */ * orientation (more intuitive than splitting again) */
if (con_num_children(parent) == 1) { if (con_num_children(parent) == 1 &&
parent->layout == L_DEFAULT) {
parent->orientation = orientation; parent->orientation = orientation;
DLOG("Just changing orientation of existing container\n"); DLOG("Just changing orientation of existing container\n");
return; return;

View File

@ -89,4 +89,25 @@ cmd 'split v';
my $count = sum_nodes(\@content); my $count = sum_nodes(\@content);
is($count, $old_count, 'not more windows after splitting again'); is($count, $old_count, 'not more windows after splitting again');
######################################################################
# In the special case of being inside a stacked or tabbed container, we dont
# want this to happen.
######################################################################
$tmp = fresh_workspace;
cmd 'open';
@content = @{get_ws_content($tmp)};
is(scalar @content, 1, 'Precisely one container on this ws');
cmd 'layout stacked';
@content = @{get_ws_content($tmp)};
is(scalar @content, 1, 'Still one container on this ws');
is(scalar @{$content[0]->{nodes}}, 1, 'Stacked con has one child node');
cmd 'split h';
cmd 'open';
@content = @{get_ws_content($tmp)};
is(scalar @content, 1, 'Still one container on this ws');
is(scalar @{$content[0]->{nodes}}, 1, 'Stacked con still has one child node');
done_testing; done_testing;