allow parsing multiple nodes from a json layout
This commit is contained in:
parent
6800524f2e
commit
ef7b3e5464
@ -421,6 +421,8 @@ void tree_append_json(const char *filename) {
|
||||
#endif
|
||||
/* Allowing comments allows for more user-friendly layout files. */
|
||||
yajl_config(hand, yajl_allow_comments, true);
|
||||
/* Allow multiple values, i.e. multiple nodes to attach */
|
||||
yajl_config(hand, yajl_allow_multiple_values, true);
|
||||
yajl_status stat;
|
||||
json_node = focused;
|
||||
to_focus = NULL;
|
||||
|
@ -63,6 +63,45 @@ is(@{$content[0]->{nodes}}, 2, 'node has two children');
|
||||
|
||||
close($fh);
|
||||
|
||||
################################################################################
|
||||
# two simple vsplit containers in the same file
|
||||
################################################################################
|
||||
|
||||
$ws = fresh_workspace;
|
||||
|
||||
@content = @{get_ws_content($ws)};
|
||||
is(@content, 0, 'no nodes on the new workspace yet');
|
||||
|
||||
($fh, $filename) = tempfile(UNLINK => 1);
|
||||
print $fh <<EOT;
|
||||
{
|
||||
"layout": "splitv",
|
||||
"nodes": [
|
||||
{
|
||||
},
|
||||
{
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"layout": "splitv"
|
||||
}
|
||||
EOT
|
||||
$fh->flush;
|
||||
cmd "append_layout $filename";
|
||||
|
||||
does_i3_live;
|
||||
|
||||
@content = @{get_ws_content($ws)};
|
||||
is(@content, 2, 'one node on the workspace now');
|
||||
is($content[0]->{layout}, 'splitv', 'first node has splitv layout');
|
||||
is(@{$content[0]->{nodes}}, 2, 'first node has two children');
|
||||
is($content[1]->{layout}, 'splitv', 'second node has splitv layout');
|
||||
is(@{$content[1]->{nodes}}, 0, 'first node has no children');
|
||||
|
||||
close($fh);
|
||||
|
||||
################################################################################
|
||||
# simple vsplit layout with swallow specifications
|
||||
################################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user