diff --git a/wezterm-gui/src/overlay/debug.rs b/wezterm-gui/src/overlay/debug.rs index 2837209fc..8135c1d68 100644 --- a/wezterm-gui/src/overlay/debug.rs +++ b/wezterm-gui/src/overlay/debug.rs @@ -102,18 +102,11 @@ impl LineEditorHost for LuaReplHost { editor: &mut LineEditor<'_>, ) -> Option { 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 } } diff --git a/wezterm-gui/src/overlay/prompt.rs b/wezterm-gui/src/overlay/prompt.rs index 4c2449b84..c88fca4a7 100644 --- a/wezterm-gui/src/overlay/prompt.rs +++ b/wezterm-gui/src/overlay/prompt.rs @@ -31,18 +31,11 @@ impl LineEditorHost for PromptHost { editor: &mut LineEditor<'_>, ) -> Option { 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 } } }