diff options
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/mod.rs | 6 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 00c70cea..d634bc4a 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -21,7 +21,7 @@ pub use text::Text; use helix_core::regex::Regex; use helix_core::regex::RegexBuilder; -use helix_view::{Document, Editor, View}; +use helix_view::{Document, View}; use std::path::PathBuf; @@ -151,8 +151,8 @@ pub fn file_picker(root: PathBuf) -> FilePicker<PathBuf> { .unwrap() .into() }, - move |editor: &mut Editor, path: &PathBuf, action| { - editor + move |cx, path: &PathBuf, action| { + cx.editor .open(path.into(), action) .expect("editor.open failed"); }, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 3e805fac..01e5f6c3 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -84,7 +84,7 @@ impl<T> FilePicker<T> { pub fn new( options: Vec<T>, format_fn: impl Fn(&T) -> Cow<str> + 'static, - callback_fn: impl Fn(&mut Editor, &T, Action) + 'static, + callback_fn: impl Fn(&mut Context, &T, Action) + 'static, preview_fn: impl Fn(&Editor, &T) -> Option<FileLocation> + 'static, ) -> Self { Self { @@ -278,7 +278,7 @@ pub struct Picker<T> { render_centered: bool, format_fn: Box<dyn Fn(&T) -> Cow<str>>, - callback_fn: Box<dyn Fn(&mut Editor, &T, Action)>, + callback_fn: Box<dyn Fn(&mut Context, &T, Action)>, } impl<T> Picker<T> { @@ -286,7 +286,7 @@ impl<T> Picker<T> { render_centered: bool, options: Vec<T>, format_fn: impl Fn(&T) -> Cow<str> + 'static, - callback_fn: impl Fn(&mut Editor, &T, Action) + 'static, + callback_fn: impl Fn(&mut Context, &T, Action) + 'static, ) -> Self { let prompt = Prompt::new( "".into(), @@ -452,7 +452,7 @@ impl<T: 'static> Component for Picker<T> { .. } => { if let Some(option) = self.selection() { - (self.callback_fn)(&mut cx.editor, option, Action::Replace); + (self.callback_fn)(cx, option, Action::Replace); } return close_fn; } @@ -461,7 +461,7 @@ impl<T: 'static> Component for Picker<T> { modifiers: KeyModifiers::CONTROL, } => { if let Some(option) = self.selection() { - (self.callback_fn)(&mut cx.editor, option, Action::HorizontalSplit); + (self.callback_fn)(cx, option, Action::HorizontalSplit); } return close_fn; } @@ -470,7 +470,7 @@ impl<T: 'static> Component for Picker<T> { modifiers: KeyModifiers::CONTROL, } => { if let Some(option) = self.selection() { - (self.callback_fn)(&mut cx.editor, option, Action::VerticalSplit); + (self.callback_fn)(cx, option, Action::VerticalSplit); } return close_fn; } |