From c5141a71eaddcb37dc4bf10b9ccf0f9424f12c38 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 18 Oct 2016 12:52:08 +0200 Subject: [PATCH] Fix `` handling in Normal mode When pressing `` inside a text input, `` is not supposed to be passed on to the page (like is otherwise done), to allow blurring text inputs inside modals without also closing the modal. There already was logic for this, but it didn't work because the check for the currently selected element and the running of the `` command was run in the wrong order. --- extension/lib/modes.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extension/lib/modes.coffee b/extension/lib/modes.coffee index 569677e..79c38e5 100644 --- a/extension/lib/modes.coffee +++ b/extension/lib/modes.coffee @@ -63,6 +63,7 @@ mode('normal', { onInput: (args, match) -> {vim, storage, event} = args {keyStr} = match + focusTypeBeforeCommand = vim.focusType vim.hideNotification() if match.type in ['none', 'full'] @@ -100,10 +101,11 @@ mode('normal', { # open the split console. return utils.isDevtoolsElement(event.originalTarget) else - # In web pages content, an exception is made if an element that VimFx + # In web page content, an exception is made if an element that VimFx # cares about is focused. That allows for blurring an input in a custom - # dialog without closing the dialog too. - return vim.focusType != 'none' + # dialog without closing the dialog too. Note that running a command might + # change `vim.focusType`, which is why this saved value is used here. + return focusTypeBeforeCommand != 'none' # Note that this special handling of Escape is only used in Normal mode. # There are two reasons we might suppress it in other modes. If some custom -- 2.39.3