fix: align URL hint hit-box with wide/multibyte glyphs#1627
Open
nikicat wants to merge 1 commit into
Open
Conversation
Closes raphamorim#1619. Regex hint extraction pushed `cell.c()` for every column (spacer placeholders included) and then used onig byte offsets directly as grid columns, so a wide glyph or multibyte codepoint earlier on the line shifted the underline and click target right by the difference between byte count and cell count. Threaded a byte-offset → grid column map through both call sites and added regression coverage for emoji, CJK, multibyte-narrow, post-processing, and the real-world `⏺ https://` trigger from the bug report. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit 194b694)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1619. The clickable-URL underline and hit-region were horizontally
misaligned when a wide (emoji/CJK) or multibyte glyph preceded the URL on the
same line.
Details
Regex hint extraction pushed
cell.c()for every column (spacer placeholdersincluded) and then used onig byte offsets directly as grid columns, so a wide
glyph or multibyte codepoint earlier on the line shifted the underline and click
target right by the difference between byte count and cell count. This threads a
byte-offset → grid-column map through both call sites and accounts for the
trailing wide-cell spacer.
Testing
cargo test -p rioterm— adds regression coverage for emoji, CJK,multibyte-narrow, post-processing, and the real-world
⏺ https://trigger fromthe bug report.
Closes #1619
🤖 Generated with Claude Code