From a32f94801ea51fdfc557df8847e414a5c6cc7fd1 Mon Sep 17 00:00:00 2001 From: Radoslav Vitanov Date: Mon, 24 Oct 2016 19:58:22 +0300 Subject: [PATCH] Selecting cut text from context menu refills URL into URL bar Fixes #5063 --- js/components/urlBar.js | 3 ++- js/stores/windowStore.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/components/urlBar.js b/js/components/urlBar.js index fb4117229b0..a224810f8ae 100644 --- a/js/components/urlBar.js +++ b/js/components/urlBar.js @@ -45,7 +45,7 @@ class UrlBar extends ImmutableComponent { this.searchSelectEntry = null this.keyPressed = false this.showAutocompleteResult = debounce(() => { - if (!this.urlInput || this.keyPressed) { + if (!this.urlInput || this.keyPressed || this.locationValue.length === 0) { return } const suffixLen = this.props.locationValueSuffix.length @@ -102,6 +102,7 @@ class UrlBar extends ImmutableComponent { windowActions.setUrlBarAutocompleteEnabled(false) } windowActions.setUrlBarSuggestions(undefined, null) + windowActions.setRenderUrlBarSuggestions(false) } onKeyDown (e) { diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index bbed28fc975..adefeea7f74 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -569,6 +569,10 @@ const doAction = (action) => { case WindowConstants.WINDOW_SET_RENDER_URL_BAR_SUGGESTIONS: windowState = windowState.setIn(activeFrameStatePath().concat(['navbar', 'urlbar', 'suggestions', 'shouldRender']), action.enabled) if (!action.enabled) { + windowState = windowState.mergeIn(activeFrameStatePath().concat(['navbar', 'urlbar', 'suggestions']), { + selectedIndex: null, + suggestionList: null + }) // Make sure to remove the suffix from the url bar windowState = windowState.setIn(activeFrameStatePath().concat(['navbar', 'urlbar', 'suggestions', 'selectedIndex']), null) updateUrlSuffix(undefined)