diff options
author | Pascal Kuthe | 2022-10-01 17:35:49 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-10-11 03:25:28 +0000 |
commit | 1a87cbd5082f410aee362a274edcc817bfb9f34a (patch) | |
tree | 88be65aefbbfdb7a837c6f432f8cbadb8d5c105b | |
parent | 7af599e0af964d1ea9d3e454782ac5d977f1621f (diff) |
remove filterting with C-space from picker
-rw-r--r-- | book/src/keymap.md | 1 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 21 |
2 files changed, 0 insertions, 22 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md index 85110634..9bc1c31e 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -391,7 +391,6 @@ Keys to use within picker. Remapping currently not supported. | `PageDown`, `Ctrl-d` | Page down | | `Home` | Go to first entry | | `End` | Go to last entry | -| `Ctrl-space` | Filter options | | `Enter` | Open selected | | `Ctrl-s` | Open horizontally | | `Ctrl-v` | Open vertically | diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index ac97e3cc..c7149c61 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -310,8 +310,6 @@ pub struct Picker<T: Item> { matcher: Box<Matcher>, /// (index, score) matches: Vec<(usize, i64)>, - /// Filter over original options. - filters: Vec<usize>, // could be optimized into bit but not worth it now /// Current height of the completions box completion_height: u16, @@ -346,7 +344,6 @@ impl<T: Item> Picker<T> { editor_data, matcher: Box::new(Matcher::default()), matches: Vec::new(), - filters: Vec::new(), cursor: 0, prompt, previous_pattern: String::new(), @@ -415,13 +412,6 @@ impl<T: Item> Picker<T> { .iter() .enumerate() .filter_map(|(index, option)| { - // filter options first before matching - if !self.filters.is_empty() { - // TODO: this filters functionality seems inefficient, - // instead store and operate on filters if any - self.filters.binary_search(&index).ok()?; - } - let text = option.filter_text(&self.editor_data); query @@ -485,14 +475,6 @@ impl<T: Item> Picker<T> { .map(|(index, _score)| &self.options[*index]) } - 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(cx.editor); - } - pub fn toggle_preview(&mut self) { self.show_preview = !self.show_preview; } @@ -573,9 +555,6 @@ impl<T: Item + 'static> Component for Picker<T> { } return close_fn; } - ctrl!(' ') => { - self.save_filter(cx); - } ctrl!('t') => { self.toggle_preview(); } |