Implement 'split'

This commit is contained in:
Michael Stapelberg
2010-05-10 09:33:10 +02:00
parent 145ebc7584
commit 6a1c34d2c5
7 changed files with 86 additions and 8 deletions

View File

@ -113,6 +113,7 @@ void parse_cmd(const char *new) {
%token TOK_OPEN "open"
%token TOK_NEXT "next"
%token TOK_PREV "prev"
%token TOK_SPLIT "split"
%token TOK_HORIZONTAL "horizontal"
%token TOK_VERTICAL "vertical"
@ -256,6 +257,7 @@ operation:
| fullscreen
| next
| prev
| split
;
exec:
@ -357,6 +359,14 @@ prev:
}
;
split:
TOK_SPLIT WHITESPACE direction
{
printf("splitting in direction %c\n", $<chr>3);
tree_split(focused, ($<chr>3 == 'v' ? VERT : HORIZ));
}
;
direction:
TOK_HORIZONTAL { $<chr>$ = 'h'; }
| 'h' { $<chr>$ = 'h'; }