add ClearSelection action
refs: https://github.com/wez/wezterm/issues/1900
This commit is contained in:
1 parent
4bc8165f53
commit
e9cd0ce072
4 files changed
+11
-2
No files matched your search
@@ -328,6 +328,7 @@ pub enum KeyAssignment {
|
||||
SelectTextAtMouseCursor(SelectionMode),
|
||||
ExtendSelectionToMouseCursor(Option<SelectionMode>),
|
||||
OpenLinkAtMouseCursor,
|
||||
ClearSelection,
|
||||
CompleteSelection(ClipboardCopyDestination),
|
||||
CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardCopyDestination),
|
||||
StartWindowDrag,
|
||||
|
||||
@@ -22,7 +22,6 @@ pub struct Selection {
|
||||
pub use config::keyassignment::SelectionMode;
|
||||
|
||||
impl Selection {
|
||||
#[allow(dead_code)]
|
||||
pub fn clear(&mut self) {
|
||||
self.range = None;
|
||||
self.origin = None;
|
||||
@@ -33,7 +32,6 @@ impl Selection {
|
||||
self.origin = Some(origin);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.range.is_none()
|
||||
}
|
||||
|
||||
@@ -2184,6 +2184,9 @@ impl TermWindow {
|
||||
ExtendSelectionToMouseCursor(mode) => {
|
||||
self.extend_selection_at_mouse_cursor(*mode, pane)
|
||||
}
|
||||
ClearSelection => {
|
||||
self.clear_selection(pane);
|
||||
}
|
||||
StartWindowDrag => {
|
||||
self.window_drag_position = self.current_mouse_event.clone();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,13 @@ impl super::TermWindow {
|
||||
s
|
||||
}
|
||||
|
||||
pub fn clear_selection(&mut self, pane: &Rc<dyn Pane>) {
|
||||
let mut selection = self.selection(pane.pane_id());
|
||||
selection.clear();
|
||||
selection.seqno = pane.get_current_seqno();
|
||||
self.window.as_ref().unwrap().invalidate();
|
||||
}
|
||||
|
||||
pub fn extend_selection_at_mouse_cursor(
|
||||
&mut self,
|
||||
mode: Option<SelectionMode>,
|
||||
|
||||
Reference in new issue
Block a user