aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/prompt.rs
diff options
context:
space:
mode:
authorIvan Tham2021-06-12 10:46:05 +0000
committerIvan Tham2021-06-15 04:00:31 +0000
commit002f1ad397a6fff4fec044e05a8784c643a04d48 (patch)
tree07e7fa9435cbef705963fb05575d66b0813d0cd2 /helix-term/src/ui/prompt.rs
parent7c2fb92c9170ff108bef244e7aed82e29156ae5c (diff)
Add filter ability to picker
Inspired by doom emacs. Able to filter picker options multiple times.
Diffstat (limited to 'helix-term/src/ui/prompt.rs')
-rw-r--r--helix-term/src/ui/prompt.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 433de15e..c388c315 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -106,6 +106,13 @@ impl Prompt {
self.exit_selection();
}
+ pub fn clear(&mut self) {
+ self.line.clear();
+ self.cursor = 0;
+ self.completion = (self.completion_fn)(&self.line);
+ self.exit_selection();
+ }
+
pub fn change_completion_selection(&mut self, direction: CompletionDirection) {
if self.completion.is_empty() {
return;