Skip to content

chore: TUI polish from audit low-severity findings - #67

Merged
bgreenwell merged 1 commit into
mainfrom
chore/tui-polish
Jul 11, 2026
Merged

chore: TUI polish from audit low-severity findings#67
bgreenwell merged 1 commit into
mainfrom
chore/tui-polish

Conversation

@bgreenwell

Copy link
Copy Markdown
Owner

Batches the five low-severity findings from the code audit that never got individual issues:

  • Jump-mode overflow: parse_cell_address used unchecked col * 26 + …, so a 14+ letter address wrapped silently in release builds (wrong jump target) and panicked in debug. Now checked, returning None. Regression test included.
  • Search highlight lag: rendering did a linear Vec::contains per visible cell per frame — O(matches × visible cells). A common-letter query on a large sheet yields tens of thousands of matches and visible lag. Matches are now mirrored into a HashSet for O(1) lookups; the Vec stays for next/prev ordering.
  • Dead progress indicator: perform_search is synchronous, so ProgressInfo was set and cleared without a render ever happening between — the ⏳ UI could never appear. Removed (~40 lines).
  • Column width byte-counting: -H auto-sizing measured str::len() (bytes), over-sizing columns for accented/CJK content. Now chars().count(), matching the width heuristic used elsewhere.
  • >100-column collapse: the default layout used Percentage(100 / width), which truncates to 0% past 100 columns, rendering every column invisible without -H. Now Constraint::Ratio(1, width).

Net −30 lines. fmt/clippy clean, 56 unit + 38 integration tests pass. TUI smoke-tested under a pty (launch, render, quit); a scripted search-input hang turned out to reproduce identically on main and is a pty stdin-preloading artifact of the harness, not app behavior.

- Jump-mode cell addresses now use checked base-26 arithmetic; 14+
  letters returned garbage in release builds and panicked in debug.
- Search-match highlighting uses a HashSet instead of a linear Vec
  scan per visible cell per frame, which lagged with many matches.
- Remove the dead search progress indicator: perform_search is
  synchronous, so the progress state was set and cleared without ever
  rendering.
- Auto-sized column widths (-H) measure chars, not bytes, so multibyte
  UTF-8 content no longer over-sizes columns.
- Column layout uses Ratio instead of Percentage(100/width), which
  truncates to 0% past 100 columns and collapsed every column.
@bgreenwell
bgreenwell merged commit 242406f into main Jul 11, 2026
9 checks passed
@bgreenwell
bgreenwell deleted the chore/tui-polish branch July 11, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant