summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/prompt.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-09 02:24:31 +0000
committerGitHub2023-02-09 02:24:31 +0000
commite474779c8729c36335b76badc98d8211829122d2 (patch)
tree8543a76fca8dfcfe6988e195c6af01b431da3af7 /helix-term/src/ui/prompt.rs
parentbd14f5a72cec6932cf1792d62e420349eaec60db (diff)
bump msrv to 1.63 (#5570)
* bump msrv to 1.63 * resolve new complex type clippy lints
Diffstat (limited to 'helix-term/src/ui/prompt.rs')
-rw-r--r--helix-term/src/ui/prompt.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 5fb6745a..f438231f 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -14,8 +14,11 @@ use helix_view::{
Editor,
};
-pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
type PromptCharHandler = Box<dyn Fn(&mut Prompt, char, &Context)>;
+pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
+type CompletionFn = Box<dyn FnMut(&Editor, &str) -> Vec<Completion>>;
+type CallbackFn = Box<dyn FnMut(&mut Context, &str, PromptEvent)>;
+pub type DocFn = Box<dyn Fn(&str) -> Option<Cow<str>>>;
pub struct Prompt {
prompt: Cow<'static, str>,
@@ -25,9 +28,9 @@ pub struct Prompt {
selection: Option<usize>,
history_register: Option<char>,
history_pos: Option<usize>,
- completion_fn: Box<dyn FnMut(&Editor, &str) -> Vec<Completion>>,
- callback_fn: Box<dyn FnMut(&mut Context, &str, PromptEvent)>,
- pub doc_fn: Box<dyn Fn(&str) -> Option<Cow<str>>>,
+ completion_fn: CompletionFn,
+ callback_fn: CallbackFn,
+ pub doc_fn: DocFn,
next_char_handler: Option<PromptCharHandler>,
}