Skip to content

Commit

Permalink
Clear selection when exiting visual mode
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasschafer committed Feb 1, 2025
1 parent abb5c08 commit 26024f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core_editor/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ impl Editor {
None
};
}

/// Sets the selection anchor to None, clearing the selection
pub fn clear_selection_anchor(&mut self) {
self.selection_anchor = None;
}

fn move_to_position(&mut self, position: usize, select: bool) {
self.update_selection_anchor(select);
self.line_buffer.set_insertion_point(position)
Expand Down
1 change: 1 addition & 0 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ impl Reedline {
}
ReedlineEvent::Esc => {
self.deactivate_menus();
self.editor.clear_selection_anchor();
Ok(EventStatus::Handled)
}
ReedlineEvent::CtrlD => {
Expand Down

0 comments on commit 26024f3

Please sign in to comment.