-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
3d41792
to
c5c8895
Compare
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); | ||
} |
There was a problem hiding this comment.
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.
Replaced by #2458 |
Refs #1512
Outstanding issues: