Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic support for C-r to paste register in prompt #1924

Closed
wants to merge 1 commit into from

Conversation

J-Fields
Copy link

@J-Fields J-Fields commented Apr 2, 2022

Refs #1512

Outstanding issues:

  • The registers info box is obscured by suggestions; unsure if there's an easy way around this

@J-Fields J-Fields force-pushed the 1512-prompt-register branch from 3d41792 to c5c8895 Compare April 4, 2022 16:42
@pickfire
Copy link
Contributor

Thanks for working on this.

Screenshot_20220418_231929

Like you mentioned, the infobox being drawn in the back doesn't look nice.

Comment on lines +456 to +473
if self.pending_register {
// C-r was pressed previously; this keystroke is the register
self.pending_register = false;
cx.editor.autoinfo = None;

if let KeyEvent {
code: KeyCode::Char(register),
modifiers: KeyModifiers::NONE,
} = event.into()
{
if let Some(text) = cx.editor.registers.get(register) {
self.insert_str(&text.read()[0]);
}
}

(self.callback_fn)(cx, &self.line, PromptEvent::Update);
return EventResult::Consumed(None);
}
Copy link
Contributor

@pickfire pickfire Apr 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels weird to me and if more and more states are being added it might be less maintainable, I think it might be better to have some sort of state machine (like using enum) here to make sure we can't go wrong. But maybe someone else might have a better solution for this.

But sadly we can't hook on_next_key nicely here.

@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 18, 2022
@archseer
Copy link
Member

Replaced by #2458

@archseer archseer closed this May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants