From 134a94a31b1caf600cb5ebf02cc46e0a5b1dbe30 Mon Sep 17 00:00:00 2001 From: Volodymyr Shatskyi Date: Sat, 27 May 2017 10:54:01 +0300 Subject: [PATCH] Revert closing a session on Ctrl+D. This reverts commit 5d1e9802b0e2f0af38f2b4ba20c2e4d0d804f848. --- src/Enums.ts | 1 + src/views/1_ApplicationComponent.tsx | 11 +++++++++++ src/views/keyevents/Keybindings.ts | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/src/Enums.ts b/src/Enums.ts index 4bede94db..b1a6dcc8d 100644 --- a/src/Enums.ts +++ b/src/Enums.ts @@ -120,6 +120,7 @@ export enum KeyboardAction { // pane commands panePrevious, paneNext, + paneClose, // edit/clipboard commands clipboardCopy, clipboardCut, diff --git a/src/views/1_ApplicationComponent.tsx b/src/views/1_ApplicationComponent.tsx index 36a8f87af..0ffa42c98 100644 --- a/src/views/1_ApplicationComponent.tsx +++ b/src/views/1_ApplicationComponent.tsx @@ -150,6 +150,17 @@ export class ApplicationComponent extends React.Component<{}, ApplicationState> return; } + // Close focused pane + if (isKeybindingForEvent(event, KeyboardAction.paneClose) && jobFormComponent) { + this.closeFocusedPane(); + + this.forceUpdate(); + + event.stopPropagation(); + event.preventDefault(); + return; + } + // Change focussed tab if (isKeybindingForEvent(event, KeyboardAction.tabFocus)) { const position = parseInt(event.key, 10); diff --git a/src/views/keyevents/Keybindings.ts b/src/views/keyevents/Keybindings.ts index 29e34a7ba..f9c610912 100644 --- a/src/views/keyevents/Keybindings.ts +++ b/src/views/keyevents/Keybindings.ts @@ -72,6 +72,11 @@ export const KeybindingsForActions: KeybindingType[] = [ return (e.ctrlKey && e.keyCode === KeyCode.N) || (e.keyCode === KeyCode.Down); }, }, + // pane command + { + action: KeyboardAction.paneClose, + keybinding: (e: KeyboardEvent) => isMeta(e) && e.keyCode === KeyCode.D, + }, // tab commands { action: KeyboardAction.tabFocus,