fix(minimap): count soft-wrapped terminal rows - #7
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a16ed91b18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if column.saturating_add(width) > columns { | ||
| rows.push(Vec::new()); | ||
| column = 0; |
There was a problem hiding this comment.
Measure grapheme clusters before inserting wraps
When output contains multi-code-point emoji such as repeated ZWJ or skin-tone sequences, VTE renders each grapheme as one terminal cluster, but this parser advances column once per Unicode scalar via terminal_cell_width. A two-emoji ZWJ cluster is therefore counted as four cells even though it occupies two, so this new condition inserts rows before VTE actually wraps and the minimap viewport/click mapping drifts. Calculate widths using the same grapheme semantics as VTE, and apply that calculation to the plain-text fallback as well.
Useful? React with 👍 / 👎.
Summary
Root cause
VTE omits newline characters between soft-wrapped screen rows. The minimap parser treated those rows as one logical line, so long or high-volume
grepoutput collapsed in the preview while the terminal scroll adjustment continued to count every screen row.Impact
Long wrapped output now occupies the same number of rows in the minimap and terminal, keeping the viewport indicator and click navigation aligned.
Validation
cargo build -p flowmuxxvfb-run -a dbus-run-session -- cargo test -p flowmux -- --nocapture— 620 passedgrep -r flowmux ., including wrapped output and minimap midpoint navigation