Skip to content

Commit 1a87cbd

Browse files
pascalkuthearchseer
authored andcommitted
remove filterting with C-space from picker
1 parent 7af599e commit 1a87cbd

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

book/src/keymap.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

0 commit comments

Comments
 (0)