Skip to content

Commit

Permalink
show autoinfo when inserting register
Browse files Browse the repository at this point in the history
  • Loading branch information
QiBaobin committed May 13, 2022
1 parent 88e0577 commit 5488344
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions helix-term/src/ui/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use helix_view::{
};

pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
type PromptCharHandler = Box<dyn Fn(&mut Prompt, char, &Context)>;
type PromptCharHandler = Box<dyn Fn(&mut Prompt, char, &mut Context)>;

pub struct Prompt {
prompt: Cow<'static, str>,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5488344

Please sign in to comment.