From 84810e67779af49e0f1b4fb8373a3acc61bfe4c2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Mar 2021 12:02:54 +0530 Subject: [PATCH] Make the destructive shortcuts mode sensitive --- src/pyj/read_book/selection_bar.pyj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/selection_bar.pyj b/src/pyj/read_book/selection_bar.pyj index b603a20695..94a7dca769 100644 --- a/src/pyj/read_book/selection_bar.pyj +++ b/src/pyj/read_book/selection_bar.pyj @@ -564,9 +564,12 @@ class SelectionBar: def on_keydown(self, ev): ev.stopPropagation(), ev.preventDefault() if ev.key is 'Escape': - self.clear_selection() + if self.state is EDITING: + self.hide_editor() + else: + self.clear_selection() return - if ev.key is 'Delete': + if ev.key is 'Delete' and self.state is WAITING: self.remove_highlight() return if ev.key and ev.key.toLowerCase() is 'c' and ev.ctrlKey: