diff options
author | Jonathan LEI | 2024-02-19 13:08:26 +0000 |
---|---|---|
committer | GitHub | 2024-02-19 13:08:26 +0000 |
commit | cdef4f8a701f921c29fdfe66f104a2edac7fe05c (patch) | |
tree | aa65defa1a20c7cf303b700b5d4c46906d823340 /helix-view/src/editor.rs | |
parent | 787cc36092a5d1a575697287d1d6ba08336a8a96 (diff) |
Make mouse click extend selection in select mode (#5436)
* Make mouse click extend selection in select mode
* chore: better readability with `Option::take()`
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 68b74cf0..fffbe620 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -42,7 +42,7 @@ pub use helix_core::diagnostic::Severity; use helix_core::{ auto_pairs::AutoPairs, syntax::{self, AutoPairConfig, IndentationHeuristic, LanguageServerFeature, SoftWrap}, - Change, LineEnding, Position, Selection, NATIVE_LINE_ENDING, + Change, LineEnding, Position, Range, Selection, NATIVE_LINE_ENDING, }; use helix_dap as dap; use helix_lsp::lsp; @@ -964,6 +964,8 @@ pub struct Editor { /// times during rendering and should not be set by other functions. pub cursor_cache: Cell<Option<Option<Position>>>, pub handlers: Handlers, + + pub mouse_down_range: Option<Range>, } pub type Motion = Box<dyn Fn(&mut Editor)>; @@ -1080,6 +1082,7 @@ impl Editor { needs_redraw: false, cursor_cache: Cell::new(None), handlers, + mouse_down_range: None, } } @@ -1978,7 +1981,7 @@ impl Editor { /// Switches the editor into normal mode. pub fn enter_normal_mode(&mut self) { - use helix_core::{graphemes, Range}; + use helix_core::graphemes; if self.mode == Mode::Normal { return; |