summaryrefslogtreecommitdiffstats
path: root/tis-curses.c
diff options
context:
space:
mode:
Diffstat (limited to 'tis-curses.c')
-rw-r--r--tis-curses.c18
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++;
}
}