diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
| commit | dcacc00e3750300617ba6e16eb346713f91a783a (patch) | |
| tree | 38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/dte/screen-status.c | |
| parent | 58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff) | |
| download | crep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz | |
Remove testing data
Diffstat (limited to 'examples/dte/screen-status.c')
| -rw-r--r-- | examples/dte/screen-status.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/examples/dte/screen-status.c b/examples/dte/screen-status.c deleted file mode 100644 index c7ec837..0000000 --- a/examples/dte/screen-status.c +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | #include "screen.h" | ||
| 2 | #include "status.h" | ||
| 3 | |||
| 4 | void update_status_line(const Window *window) | ||
| 5 | { | ||
| 6 | EditorState *e = window->editor; | ||
| 7 | const GlobalOptions *opts = &e->options; | ||
| 8 | InputMode mode = e->input_mode; | ||
| 9 | char lbuf[512], rbuf[512]; | ||
| 10 | sf_format(window, opts, mode, lbuf, sizeof lbuf, opts->statusline_left); | ||
| 11 | sf_format(window, opts, mode, rbuf, sizeof rbuf, opts->statusline_right); | ||
| 12 | |||
| 13 | const ColorScheme *colors = &e->colors; | ||
| 14 | Terminal *term = &e->terminal; | ||
| 15 | TermOutputBuffer *obuf = &term->obuf; | ||
| 16 | size_t lw = u_str_width(lbuf); | ||
| 17 | size_t rw = u_str_width(rbuf); | ||
| 18 | int w = window->w; | ||
| 19 | static_assert_compatible_types(w, window->w); | ||
| 20 | term_output_reset(term, window->x, w, 0); | ||
| 21 | term_move_cursor(obuf, window->x, window->y + window->h - 1); | ||
| 22 | set_builtin_color(term, colors, BC_STATUSLINE); | ||
| 23 | |||
| 24 | if (lw + rw <= w) { | ||
| 25 | // Both fit | ||
| 26 | term_add_str(obuf, lbuf); | ||
| 27 | term_set_bytes(term, ' ', w - lw - rw); | ||
| 28 | term_add_str(obuf, rbuf); | ||
| 29 | } else if (lw <= w && rw <= w) { | ||
| 30 | // Both would fit separately, draw overlapping | ||
| 31 | term_add_str(obuf, lbuf); | ||
| 32 | obuf->x = w - rw; | ||
| 33 | term_move_cursor(obuf, window->x + w - rw, window->y + window->h - 1); | ||
| 34 | term_add_str(obuf, rbuf); | ||
| 35 | } else if (lw <= w) { | ||
| 36 | // Left fits | ||
| 37 | term_add_str(obuf, lbuf); | ||
| 38 | term_clear_eol(term); | ||
| 39 | } else if (rw <= w) { | ||
| 40 | // Right fits | ||
| 41 | term_set_bytes(term, ' ', w - rw); | ||
| 42 | term_add_str(obuf, rbuf); | ||
| 43 | } else { | ||
| 44 | term_clear_eol(term); | ||
| 45 | } | ||
| 46 | } | ||
