Repository navigation
Conversation
Assisted-By: Docker Agent
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Highlighting still slices at raw mouse columns, so partial-width selections of wide graphemes can display spaces while copying the full glyph; highlight bounds need to match the clipboard’s grapheme boundaries.
1 open issue
What changed in this PR
This PR improves text selection in the message TUI by preserving rendered table coordinates and handling Unicode graphemes consistently during word selection and clipboard extraction.
Changes:
- Preserve table borders during hit testing and use Unicode-aware word classification.
- Add grapheme-based clipboard extraction and update display-width calculations.
- Preserve auto-copy after multi-click drags return to their starting point, with regression tests.
| File | Description |
|---|---|
pkg/tui/components/messages/selection.go |
Updates word selection, width calculations, and drag state. |
pkg/tui/components/messages/selection_test.go |
Tests Markdown, Unicode, highlighting, and drag behavior. |
pkg/tui/components/messages/messages.go |
Tracks movement to preserve copy-on-release behavior. |
pkg/tui/components/messages/lineutil.go |
Adds grapheme-to-column mapping and updates styling width calculations. |
pkg/tui/components/messages/clipboard.go |
Extracts whole intersecting graphemes and rejects empty selections. |
pkg/tui/components/messages/clipboard_test.go |
Tests clipboard extraction across grapheme and border boundaries. |
Review effort: Balanced
| func styleLineSegment(line string, startCol, endCol int, style lipgloss.Style) string { | ||
| plainLine := ansi.Strip(line) | ||
| plainWidth := runewidth.StringWidth(plainLine) | ||
| plainWidth := ansi.StringWidth(line) |
This branch has not been deployed
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
Validation
task dev(build, full tests, and lint) passed.