Skip to content

Commit 1fc76e5

Browse files
echobtfactorydroid
andauthored
fix(tui): enable right-click copy anywhere when text is selected (#355)
Previously, right-click copy only worked when clicking within a registered click zone. This fix ensures that when text is selected (via left-click drag), right-clicking anywhere on the screen will copy the selected text to clipboard. This matches the expected behavior in terminal emulators where right-click should copy selected text regardless of where the click lands. Co-authored-by: Droid Agent <droid@factory.ai>
1 parent 4083bf2 commit 1fc76e5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

cortex-tui/src/runner/event_loop.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8778,6 +8778,15 @@ impl EventLoop {
87788778
}
87798779
}
87808780

8781+
// Right-click with selection: always copy, regardless of click zone
8782+
// This enables right-click to copy anywhere on screen when text is selected
8783+
if button == MouseButton::Right && self.app_state.text_selection.has_selection() {
8784+
self.copy_selection_to_clipboard(terminal)?;
8785+
self.app_state.text_selection.clear();
8786+
self.render(terminal)?;
8787+
return Ok(());
8788+
}
8789+
87818790
// Handle clicks in Questions view
87828791
if self.app_state.view == AppView::Questions
87838792
&& button == MouseButton::Left

0 commit comments

Comments
 (0)