overlay(debug,prompt): Rewrite resolve_action to be more extensible

This commit is contained in:
Benoit de Chezelles committed 2026-08-05 03:59:22 +02:00
1 parent 1af8f19b56
commit 63061d7797
2 files changed
+10 -24

No files matched your search

+5 -12
View File
@@ -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
}
}
+5 -12
View File
@@ -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
}
}
}