1
0
Fork 0

For #5308: Show search shortcuts for search term queries

master
Sawyer Blatz 2020-03-03 09:22:52 -08:00 committed by Jeff Boek
parent 4ccda4d495
commit edd1f013ba
2 changed files with 7 additions and 1 deletions

View File

@ -81,11 +81,13 @@ class DefaultSearchController(
override fun handleTextChanged(text: String) {
// Display the search shortcuts on each entry of the search fragment (see #5308)
val textMatchesCurrentUrl = store.state.session?.url ?: "" == text
val textMatchesCurrentSearch = store.state.session?.searchTerms ?: "" == text
store.dispatch(SearchFragmentAction.UpdateQuery(text))
store.dispatch(
SearchFragmentAction.ShowSearchShortcutEnginePicker(
(textMatchesCurrentUrl || text.isEmpty()) && context.settings().shouldShowSearchShortcuts
(textMatchesCurrentUrl || textMatchesCurrentSearch || text.isEmpty()) &&
context.settings().shouldShowSearchShortcuts
)
)
store.dispatch(

View File

@ -159,6 +159,10 @@ class ToolbarView(
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()
isInitialized = true
}