mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
Fix(spotlight): improve file search query restoration and mode switching (#2887)
* fix(spotlight): fix empty results on restoring last file search query - When "remember last query" is enabled and the last query is file search, it shows "no results" until the query is manually modified in full launcher mode. * fix(spotlight): properly restore last selected mode(tab) when enabled in full launcher mode * fix(spotlight): allow file trigger in plugins mode(tab) * fix(spotlight): restore previous mode when clearing '/' file search prefix When the '/' prefix is removed from the query, the controller now correctly reverts to the previous mode instead of remaining stuck in "files" mode. * fix(spotlight): code review fix
This commit is contained in:
@@ -449,7 +449,12 @@ Item {
|
||||
searchQuery = query;
|
||||
requestSearch();
|
||||
|
||||
if (searchMode !== "plugins" && query.startsWith("/")) {
|
||||
if (autoSwitchedToFiles && !query.startsWith("/")) {
|
||||
restorePreviousMode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (query.startsWith("/")) {
|
||||
var prefix = Utils.parseFileSearchPrefix(query);
|
||||
var explicitType = prefix && prefix.type !== null ? prefix.type : null;
|
||||
var targetType = explicitType !== null ? explicitType : (SessionData.launcherLastFileSearchType || "all");
|
||||
|
||||
@@ -174,9 +174,12 @@ Item {
|
||||
spotlightContent.controller.selectedFlatIndex = 0;
|
||||
spotlightContent.controller.selectedItem = null;
|
||||
spotlightContent.controller.historyIndex = -1;
|
||||
spotlightContent.controller.searchQuery = targetQuery;
|
||||
|
||||
spotlightContent.controller.performSearch();
|
||||
if (targetQuery) {
|
||||
spotlightContent.controller.setSearchQuery(targetQuery);
|
||||
} else {
|
||||
spotlightContent.controller.searchQuery = "";
|
||||
spotlightContent.controller.performSearch();
|
||||
}
|
||||
}
|
||||
if (spotlightContent.resetScroll) {
|
||||
spotlightContent.resetScroll();
|
||||
@@ -271,7 +274,7 @@ Item {
|
||||
target: spotlightContent?.controller ?? null
|
||||
|
||||
function onModeChanged(mode, userInitiated) {
|
||||
if (!userInitiated || !SettingsData.rememberLastMode || (mode !== "all" && mode !== "apps"))
|
||||
if (!userInitiated || !SettingsData.rememberLastMode)
|
||||
return;
|
||||
SessionData.setLauncherLastMode(mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user