Troubleshooting
Terminal displays broken Unicode borders (??? or misaligned width)
- Ensure your terminal emulator uses a UTF-8 locale (
LANG=en_US.UTF-8) and monospace Unicode font. - On Windows,
tui.zigsets console output & input code pages to UTF-8 (CP 65001) automatically duringapp.enter(). - Check if
NO_COLORorTERM=dumbis exported in your environment, which intentionally degrades rendering capabilities.
Hardware cursor appears in the wrong place or stays visible after exit
- Ensure
defer app.deinit();appears immediately aftertui.init(...)so normal exits and error paths restore raw mode, alternate screen, mouse tracking, and cursor visibility. - When focused on a custom input widget, call
ui.setCursor(x, y)using coordinates insideui.area;Appautomatically shows the hardware cursor on frames with a cursor request and hides it otherwise.
zig
var app = try tui.init(alloc, .{ .io = init.io });
defer app.deinit(); // Always place immediately after tui.init()Mouse clicks miss bordered widgets by 1 row
- Pass the exact rendered
RectfromrenderintoonEvent, or use the widget's.handleEvent(...)helper which subtractsBlockborders (b.inner(bounds)) automatically:
zig
// Store exact rendered area during render():
state.log_rect = lv_ui.area;
// Handle clicks/scrolls in onEvent() via the widget struct:
_ = (tui.LogViewer{ .entries = &logs, .block = .{ .title = "Logs" } }).handleEvent(&state.logs, event, state.log_rect);Colors look quantized to 16 or 256 colors
- Some multiplexers (
tmux,screen) omit TrueColor flags unlessCOLORTERM=truecoloris exported orTERM=tmux-256color/-directis configured. - Force TrueColor in automated checks via
.capability = .trueColor:
zig
var app = try tui.init(alloc, .{
.io = init.io,
.capability = .trueColor,
});