ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
ui/layout.c
Go to the documentation of this file.
2#include <limits.h>
3asciichat_error_t ui_layout_measure(terminal_size_t size, int header,
4 int detail, int footer, ui_layout_t *out) {
5 if (!out || size.cols < 1 || size.rows < 1 || header < 0 || detail < 0 ||
6 footer < 0 || header > INT_MAX - detail ||
7 header + detail > INT_MAX - footer)
9 "Invalid TUI geometry or fixed row counts");
10 int chrome = header + detail + footer;
11 *out = (ui_layout_t){.body_row = header + 1,
12 .body_rows = size.rows > chrome ? size.rows - chrome : 0,
13 .detail_row = size.rows - detail - footer + 1,
14 .footer_row = size.rows - footer + 1};
15 if (out->detail_row < 1)
16 out->detail_row = 1;
17 if (out->footer_row < 1)
18 out->footer_row = 1;
19 return ASCIICHAT_OK;
20}
#define SET_ERRNO(code,...)
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
@ ASCIICHAT_OK
Definition error_codes.h:50
@ ERROR_INVALID_PARAM
static bool size_t gotel_query_t * out
Definition queries.h:10
asciichat_error_t ui_layout_measure(terminal_size_t size, int header, int detail, int footer, ui_layout_t *out)
Definition ui/layout.c:3