From 5488344de1c607d44bdf8693287a85b92cb32518 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Fri, 13 May 2022 15:18:54 +0800 Subject: [PATCH] show autoinfo when inserting register --- helix-term/src/ui/prompt.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index d1f423d1b..b745e548b 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -16,7 +16,7 @@ use helix_view::{ }; pub type Completion = (RangeFrom, Cow<'static, str>); -type PromptCharHandler = Box; +type PromptCharHandler = Box; pub struct Prompt { prompt: Cow<'static, str>, @@ -193,7 +193,7 @@ impl Prompt { } } - pub fn insert_char(&mut self, c: char, cx: &Context) { + pub fn insert_char(&mut self, c: char, cx: &mut Context) { if let Some(handler) = &self.next_char_handler.take() { handler(self, c, cx); @@ -549,7 +549,11 @@ impl Component for Prompt { } ctrl!('q') => self.exit_selection(), ctrl!('r') => { + self.completion = Vec::new(); //clear completions + cx.editor.autoinfo = + Some(helix_view::info::Info::from_registers(&cx.editor.registers)); // show registers info self.next_char_handler = Some(Box::new(|prompt, c, context| { + context.editor.autoinfo = None; prompt.insert_str( context .editor