From 53b6a78f4921aa32b842a542940f1e4f16eba8fa Mon Sep 17 00:00:00 2001 From: Hernawan Fa'iz Abdillah Date: Thu, 20 Jul 2023 14:03:07 +0700 Subject: [PATCH] handle empty menu as inapplicable --- src/engine.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine.rs b/src/engine.rs index 1c3c488c..3ece6d4c 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -879,6 +879,11 @@ impl Reedline { return Ok(EventStatus::Handled); } + if menu.get_values().len() == 0 { + menu.menu_event(MenuEvent::Deactivate); + return Ok(EventStatus::Inapplicable); + } + return Ok(EventStatus::Handled); } }