Skip to content

Conversation

@0xferrous
Copy link
Contributor

No description provided.

///
/// This setting only applies when mouse selection is enabled via
/// [`enable_mouse_selection()`](Self::enable_mouse_selection).
pub fn selection_mode(mut self, mode: SelectionMode) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think a single function is more ergonomic, i suggest deprecating enable_mouse_selection():

#[deprecated(note = "use `enable_copy_on_mouse_selection` instead", since = "0.3.0")]
pub fn enable_mouse_selection(self) -> Self {
    self.enable_copy_on_mouse_selection(SelectionMode::default())
}

/// ...
pub fn enable_copy_on_mouse_selection(mut self, mode: SelectionMode) -> Self {
    self.clipboard_selection = Some(mode);
    self
}

(enable_copy_on_mouse_selection is just what i had locally, when attempting to come up with a good replacement for enable_mouse_selection())

Copy link
Contributor Author

@0xferrous 0xferrous Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not possible to make auto copy optional/configurable? if i read correctly, the default handler doesn't copy on select, you need to ctrl/cmd+c it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beamterm does copy-on-select; it was deemed the most straightforward solution, and avoids needing to come up with a sensible default shortcut (follow browser/os conventions or terminal conventions? which terminal's conventions?).


/// Enables mouse text selection with the specified selection mode.
///
/// Selected text can be copied to clipboard with Ctrl+C (Cmd+C on macOS).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just remove this line, methinks

Copy link
Member

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@junkdog junkdog changed the title feat: allow setting SelectionMode on webgl2 backend feat: allow setting mouse SelectionMode on webgl2 backend Jan 7, 2026
@junkdog
Copy link
Member

junkdog commented Jan 7, 2026

🍪

@junkdog junkdog merged commit 603d998 into ratatui:main Jan 7, 2026
7 checks passed
This was referenced Jan 23, 2026
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.

3 participants