summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/picker.rs
diff options
context:
space:
mode:
authorCole Helbling2021-11-20 21:03:39 +0000
committerBlaž Hrastnik2022-02-17 05:02:42 +0000
commit6118486eb2dd7ed680ff38a7cc024dbfb26fbb7f (patch)
tree2b1e19fe86bc9beee95c88b0e9fa9f9c1d66eae5 /helix-term/src/ui/picker.rs
parenta1207fd7683c2e038df923704bb5790c6cdaefea (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.rs8
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) {