Skip to content

fix(copy-mode): harden wide-glyph h/l and align width source - #62

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-copy-mode-wide-glyph-85a1
Jul 24, 2026
Merged

fix(copy-mode): harden wide-glyph h/l and align width source#62
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-copy-mode-wide-glyph-85a1

Conversation

@OnlineChef

@OnlineChef OnlineChef commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the CJK copy-mode horizontal motion work (upstream #1469 / #1000).

  • Drive row_cell_glyphs through crate::ghostty::unicode_codepoint_width so it matches last_character_col / char_cell_width
  • Harden next_cell_col / prev_cell_col when the cursor sits on a wide glyph’s trailing cell
  • Add unit coverage for mid-row trailing cells and flush-right wide glyphs

Multi-model review

Addresses consensus findings from parallel Grok review of upstream #1469 (caution → ship blockers for width API + trailing-cell behavior).

Validation

Local cargo / just check are forbidden in this environment. Rely on CI (gh pr checks).

Open in Web Open in Cursor 

Greptile Summary

This PR updates copy-mode horizontal movement for wide glyphs. The main changes are:

  • Uses Ghostty’s Unicode cell-width source when building row glyph maps.
  • Treats wide-glyph leading and trailing cells as one glyph for h and l movement.
  • Adds tests for mid-row trailing cells, flush-right wide glyphs, and combining marks.

Confidence Score: 5/5

This PR appears safe to merge.

The change is localized to copy-mode horizontal cursor stepping and uses the same width source as related helpers. The added tests cover the affected wide-glyph and combining-mark cases. No functional or security issues were identified.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex attempted to run gh pr checks 62 --json and encountered an unknown flag error, causing the command to exit with status 1.
  • T-Rex attempted to run gh pr checks 62 again without the --json flag, but authentication was missing (GH_TOKEN), causing the command to exit with status 4.
  • T-Rex executed the narrow Cargo test command; the build.rs step failed when trying to run zig build for vendored libghostty-vt, exiting with code 101.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/app/input/copy_mode.rs Aligns copy-mode glyph width calculation with Ghostty width handling and updates horizontal cursor stepping and tests for wide-glyph trailing cells.

Sequence Diagram

sequenceDiagram
participant Key as h/l keypress
participant Move as move_copy_cursor
participant Row as copy_mode_visible_row_text
participant Glyphs as row_cell_glyphs
participant Step as next_cell_col/prev_cell_col

Key->>Move: horizontal copy-mode motion
Move->>Row: fetch visible row text
Row-->>Move: "Option<String>"
Move->>Glyphs: build (leading_col, width) using Ghostty width
Glyphs-->>Move: glyph cell map
Move->>Step: step from cursor_col across glyph/blank
Step-->>Move: updated cursor_col
Loading

Reviews (1): Last reviewed commit: "style(copy-mode): rustfmt wide-glyph hel..." | Re-trigger Greptile

Use ghostty unicode_codepoint_width in row_cell_glyphs, and treat
cursors on trailing cells of wide glyphs as inside-glyph for next/prev
steps so motion cannot stick on spacers at the right margin.

refs #1000

Co-authored-by: OnlineChef <OnlineChef@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c4dc30f5-dc32-46e5-9d3c-c26264144372

📥 Commits

Reviewing files that changed from the base of the PR and between 60f5fb6 and 25380a2.

📒 Files selected for processing (1)
  • src/app/input/copy_mode.rs

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved copy-mode cursor movement across wide characters and combining marks.
    • Corrected left and right navigation from trailing cells to keep the cursor aligned with glyph boundaries.
    • Prevented the cursor from moving beyond the pane’s right edge.

Walkthrough

Copy-mode cursor horizontal stepping now uses Ghostty’s glyph cell widths. Movement across wide and combined glyphs handles trailing cells explicitly, including right-edge behavior, with updated unit test expectations.

Changes

Copy-mode cursor movement

Layer / File(s) Summary
Align glyph widths with terminal cells
src/app/input/copy_mode.rs
row_cell_glyphs now uses Ghostty’s unicode_codepoint_width calculation.
Handle wide-glyph movement and boundaries
src/app/input/copy_mode.rs
Horizontal stepping handles wide-glyph trailing cells, combined glyphs, and pane-edge limits; related tests were updated.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Suggested reviewers: ogulcancelik, reobin, kovalov

Poem

I’m a rabbit hopping cell to cell,
Where wide glyphs make their shadows swell.
Trailing spaces? Back to the start!
No edge jumps, no cursor dart.
Ghostly widths keep paths precise. 🐇

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-copy-mode-wide-glyph-85a1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: OnlineChef <OnlineChef@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review July 24, 2026 03:31
@cursor
cursor Bot merged commit a79b61b into main Jul 24, 2026
10 of 11 checks passed
@cursor
cursor Bot deleted the cursor/fix-copy-mode-wide-glyph-85a1 branch July 24, 2026 03:31
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.

2 participants