From 631d8cd20d51c0add6e479cff04fd948319ba0c5 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Tue, 16 Jan 2024 04:36:27 -0500 Subject: [PATCH] Add shortcut to close the current tab Defaults to `ctrl-w`. Source: https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts#Tab_management --- src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.rs b/src/main.rs index 2e2d7ba..184a398 100644 --- a/src/main.rs +++ b/src/main.rs @@ -764,6 +764,16 @@ impl Application for App { None } } + Event::Keyboard(KeyEvent::KeyPressed { + key_code: KeyCode::W, + modifiers, + }) => { + if modifiers == Modifiers::CTRL { + Some(Message::TabClose(None)) + } else { + None + } + } Event::Keyboard(KeyEvent::KeyPressed { key_code: KeyCode::V, modifiers,