From 5adac1252fb065ecb3e308152f6b178b303d6189 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Wed, 26 Jul 2023 07:34:49 +0200 Subject: Fix tpu source rendering and tpu location duplicates --- tis-curses.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'tis-curses.c') diff --git a/tis-curses.c b/tis-curses.c index 8132f53..ea108a3 100644 --- a/tis-curses.c +++ b/tis-curses.c @@ -173,8 +173,9 @@ tui_draw_tpu(struct tpu *tpu) struct tpu_port *port; int sx, sy, x, y, w, h; int off, start, inst; + size_t len; + attr_t attr; int idle; - attr_t attr;; attr = (tpu_sel == tpu && input_mode == TPU_NAV) ? A_BOLD : 0; @@ -189,14 +190,21 @@ tui_draw_tpu(struct tpu *tpu) inst = start; for (off = 0; off < TPU_INPUT_ROWS && inst < tpu->inst_cnt; ) { if (tpu->label_map.labels[inst]) { - tui_draw_text(sx + 2, sy + 1 + off, A_DIM, - "%s:", tpu->label_map.labels[inst]); + len = strlen(tpu->label_map.labels[inst]); + if (len > TPU_INPUT_COLS - 1) { + tui_draw_text(sx + 2, sy + 1 + off, A_DIM, + "%.*s..:", TPU_INPUT_COLS - 3, + tpu->label_map.labels[inst]); + } else { + tui_draw_text(sx + 2, sy + 1 + off, A_DIM, + "%s:", tpu->label_map.labels[inst]); + } off++; } asm_print_inst(linebuf, sizeof(linebuf), &tpu->insts[inst]); tui_draw_text(sx + 2, sy + 1 + off, - inst == tpu->pc ? A_STANDOUT : 0, - "%-*s", TPU_INPUT_COLS, linebuf); + inst == tpu->pc ? A_STANDOUT : 0, "%-*.*s", + TPU_INPUT_COLS, TPU_INPUT_COLS, linebuf); inst++; off++; } } -- cgit v1.2.3-71-gd317