Two bugs fixed:
1. Arrow keys detected as ESC: sys.stdin.read(1) uses Python's internal
buffer, so after reading ESC byte, the remaining escape sequence
bytes ([A for up-arrow) were in Python's buffer but not visible to
select.select() on the OS fd. Switched to os.read(fd, 1) which
reads directly from the file descriptor, bypassing Python's buffer.
2. Footer positioned wrong: draw_footer() counted buffer items to
calculate padding, but a Rich Table renders as multiple lines.
Added _line_count tracker with _add_line() and _add_lines(n) so
footer padding is calculated from actual rendered line count.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Major issues fixed:
- Rich printed directly to stdout causing visible flicker on every redraw
- get_key() toggled raw mode per keypress causing glitches and slowness
- No alternate screen buffer — output contaminated terminal scrollback
Rewrite approach:
- Use alternate screen buffer (ESC[?1049h) for clean enter/exit
- Persistent raw mode for entire session instead of per-keypress toggle
- Buffer all Rich renderables during render cycle, flush once in refresh()
- Render to StringIO then write entire frame in single sys.stdout.write()
- Reduced ESC sequence timeout from 50ms to 20ms for snappier response
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Curses waits up to 1 second after ESC to distinguish it from escape
sequences (arrow keys, F-keys). Set ESCDELAY=25 before curses.initscr()
so ESC responds near-instantly while still handling escape sequences.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Reuse a single SQLite connection instead of open/close per query
- Add in-memory cache for frequently accessed data (brands, models,
categories) — 1000x faster on repeated access
- Enable WAL journal mode, 8MB cache, 64MB mmap for faster reads
- Cache terminal size per render cycle to avoid repeated getmaxyx()
- Close DB connection on app exit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement TextualRenderer in console/renderers/textual_renderer.py using
the Rich library for a modern dark-themed TUI with blue/cyan accents.
All 18 BaseRenderer methods are implemented: lifecycle (init_screen,
cleanup), primitives (clear, refresh, get_key, get_size), widgets
(draw_header, draw_footer, draw_menu, draw_table, draw_detail,
draw_form, draw_filter_list, draw_comparison, draw_text, draw_box),
and dialogs (show_message, show_input). Keyboard input uses raw
terminal mode via tty/termios with full escape sequence decoding
for arrow keys, F-keys, Page Up/Down, Home/End.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>