Fix/mouse coordinate selection#1209
Conversation
- Fix mouse Y coordinate mapping by accounting for header height - Add proper offset calculation for viewport-relative coordinates - Enable auto-scroll during text selection near viewport edges - Remove automatic clipboard copying on mouse release The mouse coordinates were previously calculated relative to the terminal window, but needed to be adjusted for the header height and viewport positioning. This ensures accurate text selection and smooth scrolling behavior during selection operations.
- Fixed double offset application causing 7-8 line selection offset - Mouse coordinates now correctly map to text under cursor - Selection rendering uses content-relative coordinates - Preserves auto-scroll functionality during text selection
- Fix mouse coordinate mapping for accurate text selection - Add auto-scroll functionality when selecting near viewport edges - Fix Unicode character width calculation for proper selection - Disable tail mode during selection to allow free scrolling - Remove automatic clipboard copying on mouse release
|
Thank you! This solves the text-selection problem for me. Without this PR, trying to select text actually writes text all over the screen. After this PR, I can select text normally without disturbing it. However, this PR has broken my ability to scroll down after scrolling up. Steps to reproduce: start opencode; resume a session with enough history to require scrolling; scroll up, then try scrolling back down. Only the bottom 5% of the window scrolls back down. Although I didn't actually use opencode yet before applying this PR, I can't seem to reproduce this scroll bug without this PR so I think it's new behavior. |
|
@benemorius I can't reproduce your error. Are you certain you can't scroll back down? |
- Added right-click functionality to copy selected text to clipboard - Removed revert/redo commands that were causing build issues - Maintained existing left-click selection behavior - Clean implementation based on dev branch mouse selection logic
|
added right click copy into pastebuffer |
|
If you're interested in using this pr or patching opencode, just lmk I've merged it into my own working branch "unchained" which has this and some other performance enhancements. Thanks |
f16de3d to
cc0d460
Compare
772b621 to
eb855e1
Compare
f1dc981 to
3e15a39
Compare
f8ee907 to
6a9856d
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
|
Stuff like this makes me run away as far as I can from getting involved with this project. Someone writes a good fix that is obviously needed; it gets ignored. They keep merging and fixing collisions with the After a while they give up and stop putting time into fixing the never-ending-collisions. What is opencode expecting if they don't address PR's? |
These changes make mouse text selection in the TUI chat work as expected -
like other terminal applications. Users can now select text beyond the viewport with automatic
scrolling, and clipboard behavior follows standard Ctrl+C patterns instead of immediate copy on
release.