From 78c5d7092c50e794179d3de6e45148d4036b05ab Mon Sep 17 00:00:00 2001 From: Remigiusz Micielski Date: Thu, 5 Sep 2024 12:48:24 +0200 Subject: [PATCH] esc/quit to deselect --- rm-main/src/tui/tabs/torrents/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rm-main/src/tui/tabs/torrents/mod.rs b/rm-main/src/tui/tabs/torrents/mod.rs index f44e796..9bfc7ad 100644 --- a/rm-main/src/tui/tabs/torrents/mod.rs +++ b/rm-main/src/tui/tabs/torrents/mod.rs @@ -105,8 +105,22 @@ impl Component for TorrentsTab { return ComponentAction::Nothing; } + if !self.table_manager.selected_torrents_ids.is_empty() { + if action.is_soft_quit() { + self.table_manager + .table + .items + .iter_mut() + .for_each(|t| t.is_selected = false); + self.table_manager.selected_torrents_ids.drain(..); + self.ctx.send_action(Action::Render); + return ComponentAction::Nothing; + } + } + if action.is_quit() { self.ctx.send_action(Action::HardQuit); + return ComponentAction::Nothing; } match action {