For #5308: Show search shortcuts for search term queries
parent
4ccda4d495
commit
edd1f013ba
|
@ -81,11 +81,13 @@ class DefaultSearchController(
|
||||||
override fun handleTextChanged(text: String) {
|
override fun handleTextChanged(text: String) {
|
||||||
// Display the search shortcuts on each entry of the search fragment (see #5308)
|
// Display the search shortcuts on each entry of the search fragment (see #5308)
|
||||||
val textMatchesCurrentUrl = store.state.session?.url ?: "" == text
|
val textMatchesCurrentUrl = store.state.session?.url ?: "" == text
|
||||||
|
val textMatchesCurrentSearch = store.state.session?.searchTerms ?: "" == text
|
||||||
|
|
||||||
store.dispatch(SearchFragmentAction.UpdateQuery(text))
|
store.dispatch(SearchFragmentAction.UpdateQuery(text))
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
SearchFragmentAction.ShowSearchShortcutEnginePicker(
|
SearchFragmentAction.ShowSearchShortcutEnginePicker(
|
||||||
(textMatchesCurrentUrl || text.isEmpty()) && context.settings().shouldShowSearchShortcuts
|
(textMatchesCurrentUrl || textMatchesCurrentSearch || text.isEmpty()) &&
|
||||||
|
context.settings().shouldShowSearchShortcuts
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
|
|
|
@ -159,6 +159,10 @@ class ToolbarView(
|
||||||
view.setSearchTerms(searchState.session?.searchTerms.orEmpty())
|
view.setSearchTerms(searchState.session?.searchTerms.orEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We must trigger an onTextChanged so when search terms are set when transitioning to `editMode`
|
||||||
|
// we have the most up to date text
|
||||||
|
interactor.onTextChanged(view.url.toString())
|
||||||
|
|
||||||
view.editMode()
|
view.editMode()
|
||||||
isInitialized = true
|
isInitialized = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue