Skip to content

Commit

Permalink
remove filterting with C-space from picker
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Oct 1, 2022
1 parent f5629e6 commit 435a558
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion book/src/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,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 |
Expand Down
21 changes: 0 additions & 21 deletions helix-term/src/ui/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,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,
Expand Down Expand Up @@ -322,7 +320,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(),
Expand Down Expand Up @@ -391,13 +388,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
Expand Down Expand Up @@ -461,14 +451,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;
}
Expand Down Expand Up @@ -546,9 +528,6 @@ impl<T: Item + 'static> Component for Picker<T> {
}
return close_fn;
}
ctrl!(' ') => {
self.save_filter(cx);
}
ctrl!('t') => {
self.toggle_preview();
}
Expand Down

0 comments on commit 435a558

Please sign in to comment.