diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-07-26 07:34:49 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-07-26 07:34:49 +0200 |
| commit | 5adac1252fb065ecb3e308152f6b178b303d6189 (patch) | |
| tree | 3fb9aa9aaaa65b115ddfec7ea8ab469a3ea1b68a /tis-curses.c | |
| parent | 7d73b738a5703d5263a84dcbe3564e2267af6804 (diff) | |
| download | tis100-5adac1252fb065ecb3e308152f6b178b303d6189.tar.gz tis100-5adac1252fb065ecb3e308152f6b178b303d6189.zip | |
Fix tpu source rendering and tpu location duplicates
Diffstat (limited to 'tis-curses.c')
| -rw-r--r-- | tis-curses.c | 18 |
1 files changed, 13 insertions, 5 deletions
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++; } } |
