diff options
| author | Riley Beckett <rbeckettvt@gmail.com> | 2025-10-27 19:40:08 -0400 |
|---|---|---|
| committer | Riley Beckett <rbeckettvt@gmail.com> | 2025-10-27 19:40:08 -0400 |
| commit | e42d9bb1834678fb0275dbcdfc84bc80b1ca27a8 (patch) | |
| tree | 206311382255c1bb04169b08aea9839fb95dc7f4 /layout.c | |
| parent | 2033b55f91876c8fc0d4cd3cdf9c67972ad5490c (diff) | |
add prompt
Diffstat (limited to 'layout.c')
| -rw-r--r-- | layout.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -6,12 +6,18 @@ void init_layout(client_state* state) { } -void calculate_layout(client_state* state, rect_t* input, rect_t* options, bool recalc_options) { +void calculate_layout(client_state* state, rect_t* prompt, rect_t* input, rect_t* options, bool recalc_options) { + if (state->prompt && *state->prompt) { + *prompt = (rect_t){ .x = 0, .y = state->line_height * state->lines, .dx = state->prompt_text_buffer.pixel_len + state->horizontal_spacing, .dy = state->line_height }; + } + else { + *prompt = (rect_t){ 0 }; + } // calculate input rect - *input = (rect_t){ .x = 0, .y = state->line_height * state->lines, .dx = state->width, .dy = state->line_height }; + *input = (rect_t){ .x = prompt->dx, .y = state->line_height * state->lines, .dx = state->width - prompt->dx, .dy = state->line_height }; if (state->lines == 0 && array_size(state->filtered_items) != 0) { - input->dx = state->width / 3.0f; + input->dx = state->width / 3.0f - input->x; } // calculate options rect |
