From 6c012839737b60442e582e08209f551536ca2e81 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 25 Sep 2017 19:49:37 +0900 Subject: [PATCH 1/2] support t/T command and fix alter mode --- src/actions/operation.js | 8 +++++++- src/background/keys.js | 2 ++ src/operations/index.js | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/actions/operation.js b/src/actions/operation.js index b0d67f0..50329f8 100644 --- a/src/actions/operation.js +++ b/src/actions/operation.js @@ -25,11 +25,17 @@ const exec = (operation, tab) => { case operations.COMMAND_OPEN: return consoleActions.showCommand(''); case operations.COMMAND_TABS_OPEN: - if (operations.alter) { + if (operation.alter) { // alter url return consoleActions.showCommand('open ' + tab.url); } return consoleActions.showCommand('open '); + case operations.COMMAND_TABS_NEW: + if (operation.alter) { + // alter url + return consoleActions.showCommand('tabopen ' + tab.url); + } + return consoleActions.showCommand('tabopen '); case operations.COMMAND_BUFFER: return consoleActions.showCommand('buffer '); default: diff --git a/src/background/keys.js b/src/background/keys.js index 34483a0..e4a8b19 100644 --- a/src/background/keys.js +++ b/src/background/keys.js @@ -4,6 +4,8 @@ const defaultKeymap = { ':': { type: operations.COMMAND_OPEN }, 'o': { type: operations.COMMAND_TABS_OPEN, alter: false }, 'O': { type: operations.COMMAND_TABS_OPEN, alter: true }, + 't': { type: operations.COMMAND_TABS_NEW, alter: false }, + 'T': { type: operations.COMMAND_TABS_NEW, alter: true }, 'b': { type: operations.COMMAND_BUFFER }, 'k': { type: operations.SCROLL_LINES, count: -1 }, 'j': { type: operations.SCROLL_LINES, count: 1 }, diff --git a/src/operations/index.js b/src/operations/index.js index a40123a..d6ffc42 100644 --- a/src/operations/index.js +++ b/src/operations/index.js @@ -2,6 +2,7 @@ export default { // Command COMMAND_OPEN: 'cmd.open', COMMAND_TABS_OPEN: 'cmd.tabs.open', + COMMAND_TABS_NEW: 'cmd.tabs.new', COMMAND_BUFFER: 'cmd.buffer', SCROLL_LINES: 'scroll.lines', From 1a21e548d924514e7b23add22e9ecd4fb071ea84 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 25 Sep 2017 20:57:01 +0900 Subject: [PATCH 2/2] blur on input elements when Esc pressed --- src/content/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/content/index.js b/src/content/index.js index 7ce41c1..80acd2d 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -63,6 +63,9 @@ window.addEventListener('keypress', (e) => { if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement) { + if (e.key === 'Escape' && e.target.blur) { + e.target.blur(); + } return; } browser.runtime.sendMessage({