overlay(debug,prompt): Rewrite resolve_action to be more extensible
This commit is contained in:
1 parent
1af8f19b56
commit
63061d7797
2 files changed
+10
-24
No files matched your search
@@ -102,18 +102,11 @@ impl LineEditorHost for LuaReplHost {
|
||||
editor: &mut LineEditor<'_>,
|
||||
) -> Option<Action> {
|
||||
let (line, _cursor) = editor.get_line_and_cursor();
|
||||
if line.is_empty()
|
||||
&& matches!(
|
||||
event,
|
||||
InputEvent::Key(KeyEvent {
|
||||
key: KeyCode::Escape,
|
||||
..
|
||||
})
|
||||
)
|
||||
{
|
||||
Some(Action::Cancel)
|
||||
} else {
|
||||
None
|
||||
match event {
|
||||
InputEvent::Key(KeyEvent { key: KeyCode::Escape, .. }) => {
|
||||
line.is_empty().then_some(Action::Cancel)
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,18 +31,11 @@ impl LineEditorHost for PromptHost {
|
||||
editor: &mut LineEditor<'_>,
|
||||
) -> Option<Action> {
|
||||
let (line, _cursor) = editor.get_line_and_cursor();
|
||||
if line.is_empty()
|
||||
&& matches!(
|
||||
event,
|
||||
InputEvent::Key(KeyEvent {
|
||||
key: KeyCode::Escape,
|
||||
..
|
||||
})
|
||||
)
|
||||
{
|
||||
Some(Action::Cancel)
|
||||
} else {
|
||||
None
|
||||
match event {
|
||||
InputEvent::Key(KeyEvent { key: KeyCode::Escape, .. }) => {
|
||||
line.is_empty().then_some(Action::Cancel)
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user