feat: visual select mode (v) for native text selection#129
Open
vertti wants to merge 2 commits into
Open
Conversation
Bind M to flip the bubbletea MouseMode between AllMotion and None. While off, the terminal regains native click-and-drag selection so users can copy diff lines (e.g. when reviewing changes via --watch). A "mouse off" indicator is shown in the footer alongside the existing watch label.
Switches the toggle from M (awkward shift+m next to lowercase m for commit info) to v, mirroring vim's visual-select mnemonic. Renames the footer indicator from 'mouse off' to 'visual select' since users press the key to *enable* mouse-driven text selection — 'mouse off' described the underlying capture state but read as a regression.
Owner
|
Hey @vertti , does this also work with tmux? |
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
Adds v to toggle bubbletea's mouse capture between
AllMotionandNone— a "visual select mode" that releases the mouse so the terminal can do its native click-and-drag selection. Useful for copying lines from the diff (e.g. when reviewing edits via--watchand pasting feedback elsewhere).A small
visual selectindicator appears in the footer (mirroring the existingwatching:label) so the mode change is discoverable.Why
With
tea.MouseModeAllMotionalways on, every drag is captured by the app and terminal-native text selection is suppressed. There was no way to copy a snippet from the diff. Toggling capture is the standard TUI answer (lazygit, k9s, etc.) and keeps all existing mouse UX (sidebar drag, scroll wheel, zone clicks) intact when the mode is off.Notes
MouseModeNoneis read by bubbletea v2 inView()each frame; the renderer emits the right CSI sequences when the mode changes, so toggling is instant.draggingSidebarstate is cleared on toggle to avoid orphaned drag state.