on master help sign in
remove filterting with C-space from picker
commit1a87cbd5082f410aee362a274edcc817bfb9f34a authorPascal Kuthe <pascal.kuthe@semimod.de> dateSat 1 Oct 2022, 19:35 (4 years ago) parent7af599e
2 files changed−22
book/src/keymap.md−1 helix-term/src/ui/picker.rs−21
book/src/keymap.md−1
@@ -391,7 +391,6 @@ Keys to use within picker. Remapping currently not supported.
391391| `PageDown`, `Ctrl-d` | Page down |
392392| `Home` | Go to first entry |
393393| `End` | Go to last entry |
394−| `Ctrl-space` | Filter options |
395394| `Enter` | Open selected |
396395| `Ctrl-s` | Open horizontally |
397396| `Ctrl-v` | Open vertically |
helix-term/src/ui/picker.rs−21
@@ -310,8 +310,6 @@ pub struct Picker<T: Item> {
310310 matcher: Box<Matcher>,
311311 /// (index, score)
312312 matches: Vec<(usize, i64)>,
313− /// Filter over original options.
314− filters: Vec<usize>, // could be optimized into bit but not worth it now
315313
316314 /// Current height of the completions box
317315 completion_height: u16,
@@ -346,7 +344,6 @@ impl<T: Item> Picker<T> {
346344 editor_data,
347345 matcher: Box::new(Matcher::default()),
348346 matches: Vec::new(),
349− filters: Vec::new(),
350347 cursor: 0,
351348 prompt,
352349 previous_pattern: String::new(),
@@ -415,13 +412,6 @@ impl<T: Item> Picker<T> {
415412 .iter()
416413 .enumerate()
417414 .filter_map(|(index, option)| {
418− // filter options first before matching
419− if !self.filters.is_empty() {
420− // TODO: this filters functionality seems inefficient,
421− // instead store and operate on filters if any
422− self.filters.binary_search(&index).ok()?;
423− }
424−
425415 let text = option.filter_text(&self.editor_data);
426416
427417 query
@@ -485,14 +475,6 @@ impl<T: Item> Picker<T> {
485475 .map(|(index, _score)| &self.options[*index])
486476 }
487477
488− pub fn save_filter(&mut self, cx: &Context) {
489− self.filters.clear();
490− self.filters
491− .extend(self.matches.iter().map(|(index, _)| *index));
492− self.filters.sort_unstable(); // used for binary search later
493− self.prompt.clear(cx.editor);
494− }
495−
496478 pub fn toggle_preview(&mut self) {
497479 self.show_preview = !self.show_preview;
498480 }
@@ -573,9 +555,6 @@ impl<T: Item + 'static> Component for Picker<T> {
573555 }
574556 return close_fn;
575557 }
576− ctrl!(' ') => {
577− self.save_filter(cx);
578− }
579558 ctrl!('t') => {
580559 self.toggle_preview();
581560 }