diff options
author | Cole Helbling | 2021-11-20 21:03:39 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-02-17 05:02:42 +0000 |
commit | 6118486eb2dd7ed680ff38a7cc024dbfb26fbb7f (patch) | |
tree | 2b1e19fe86bc9beee95c88b0e9fa9f9c1d66eae5 /helix-term/src/ui/picker.rs | |
parent | a1207fd7683c2e038df923704bb5790c6cdaefea (diff) |
helix-term: implement buffer completer
In order to implement this completer, the completion function needs to
be able to access the compositor's context (to allow it to get the
list of buffers currently open in the context's editor).
Diffstat (limited to 'helix-term/src/ui/picker.rs')
-rw-r--r-- | helix-term/src/ui/picker.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 9cddbc60..dcc64002 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -302,7 +302,7 @@ impl<T> Picker<T> { let prompt = Prompt::new( "".into(), None, - |_pattern: &str| Vec::new(), + |_ctx: &Context, _pattern: &str| Vec::new(), |_editor: &mut Context, _pattern: &str, _event: PromptEvent| { // }, @@ -395,12 +395,12 @@ impl<T> Picker<T> { .map(|(index, _score)| &self.options[*index]) } - pub fn save_filter(&mut self) { + pub fn save_filter(&mut self, cx: &Context) { self.filters.clear(); self.filters .extend(self.matches.iter().map(|(index, _)| *index)); self.filters.sort_unstable(); // used for binary search later - self.prompt.clear(); + self.prompt.clear(cx); } } @@ -468,7 +468,7 @@ impl<T: 'static> Component for Picker<T> { return close_fn; } ctrl!(' ') => { - self.save_filter(); + self.save_filter(cx); } _ => { if let EventResult::Consumed(_) = self.prompt.handle_event(event, cx) { |