From 79f5c5235a357d16308e0d58fe34d68b5d20944a Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Thu, 11 Sep 2025 19:26:28 +1000 Subject: [PATCH] add term_dims() func --- cli/tree.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cli/tree.c b/cli/tree.c index 41ae103..63c8088 100644 --- a/cli/tree.c +++ b/cli/tree.c @@ -87,6 +87,13 @@ static struct crs_nodedims *get_dims(const struct crs_node *node) { return dims; } +struct crs_nodedims term_dims(void) { + struct crs_nodedims dims; + getbegyx(stdscr, dims.y, dims.x); + getmaxyx(stdscr, dims.height, dims.width); + return dims; +} + /* Calculate the dimensions for nodes resulting from a bifurcation. * Returns 0 on success, and 1 on failure if any width/height are 0 characters. * WARNING: This function does not guarantee the x,y positions returned @@ -162,7 +169,6 @@ void bifurcate_window_node(struct crs_node **node, struct crs_nodedims *dims0, *dims1; struct crs_node *node0, *node1; - if (bifurcate_dims(*node, axis, ratio, &dims0, &dims1)) { printf("FAILED TERRIBLY THE FUCK\n"); exit(1); @@ -202,7 +208,15 @@ static void collapse_abstract_node(struct crs_node **node, /* */ static struct crs_node *init_root_node(void) { - return init_window_node(root_window()); + struct crs_nodedims rootdims; + WINDOW *rootwin; + + // rootdims = term_dims(); + // rootwin = new_window(rootdims.x, rootdims.y, + // rootdims.height, rootdims.height); + // rootwin = new_window(0, 0, 0, 0); + rootwin = root_window(); + return init_window_node(rootwin); } int init_tree(struct crs_tree **const tree) {