diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-02 18:24:58 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-02 18:28:50 +0900 |
commit | b8acc1bae7b8a0745b34fe06f276270b5e6a61c4 (patch) | |
tree | e4635ae5c2e9a2d958bf38be0308b4e15f0c2f67 | |
parent | 192e6fec1bbc540063bf7a56d5da98b61d1df6eb (diff) |
clsoe #13
-rw-r--r-- | src/pages/console.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pages/console.js b/src/pages/console.js index b90a9cd..2cbea25 100644 --- a/src/pages/console.js +++ b/src/pages/console.js @@ -9,6 +9,7 @@ import * as completionActions from '../actions/completion'; const completionStore = store.createStore(completionReducer); let completionComponent = null; let consoleComponent = null; +let prevState = {}; window.addEventListener('load', () => { let wrapper = document.querySelector('#vimvixen-console-completion'); @@ -22,12 +23,17 @@ completionStore.subscribe(() => { completionComponent.update(); let state = completionStore.getState(); + if (state.groupSelection >= 0) { let item = state.groups[state.groupSelection].items[state.itemSelection]; consoleComponent.setCommandValue(item.content); - } else if (state.groups.length > 0) { + } else if (state.groups.length > 0 && + JSON.stringify(prevState.groups) === JSON.stringify(state.groups)) { + // Reset input only completion groups not changed (unselected an item in + // completion) in order to avoid to override previous input consoleComponent.setCommandCompletionOrigin(); } + prevState = state; }); browser.runtime.onMessage.addListener((action) => { |