From 7bd9e5c8603a13c808d80d82db07e0af4ef785b4 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 24 Nov 2025 22:41:20 +1100 Subject: [PATCH] deprecate RawQuery add OriginalQuery --- Flow.Launcher.Core/Plugin/QueryBuilder.cs | 6 +++--- Flow.Launcher.Plugin/Query.cs | 21 +++++++++++++++++---- Flow.Launcher/ViewModel/MainViewModel.cs | 6 +++--- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index c316e7cc1c2..0c74078c981 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Flow.Launcher.Plugin; @@ -14,7 +14,7 @@ public static Query Build(string input, string text, Dictionary(), ActionKeyword = string.Empty, @@ -53,7 +53,7 @@ public static Query Build(string input, string text, Dictionary - /// Input text in query box. + /// Original query, exactly how the user has typed into the search box. /// We don't recommend using this property directly. You should always use Search property. /// - public string Input { get; internal init; } + public string OriginalQuery { get; internal init; } /// /// Raw query, this includes action keyword if it has. /// It has handled buildin custom query shortkeys and build-in shortcuts, and it trims the whitespace. /// We don't recommend using this property directly. You should always use Search property. /// - public string RawQuery { get; internal init; } + [Obsolete("RawQuery is renamed to TrimmedQUery. This property will be removed. Update the code to use TrimmedQuery instead.")] + public string RawQuery { + get { return TrimmedQuery; } + internal init { TrimmedQuery = value; } + } + + /// + /// Original query but with trimmed whitespace. Includes action keyword. + /// It has handled buildin custom query shortkeys and build-in shortcuts. + /// If after exact original query from the search box, should use OriginalQuery property instead. + /// We don't recommend using this property directly. You should always use Search property. + /// + public string TrimmedQuery { get; internal init; } /// /// Determines whether the query was forced to execute again. diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index d2a35c591e7..77ebfe7f5ed 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -284,7 +284,7 @@ public void RegisterResultsUpdatedEvent(PluginPair pair) plugin.ResultsUpdated += (s, e) => { - if (_updateQuery == null || e.Query.Input != _updateQuery.Input || e.Token.IsCancellationRequested) + if (_updateQuery == null || e.Query.OriginalQuery != _updateQuery.OriginalQuery || e.Token.IsCancellationRequested) { return; } @@ -1470,7 +1470,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b _ = Task.Delay(200, currentCancellationToken).ContinueWith(_ => { // start the progress bar if query takes more than 200 ms and this is the current running query and it didn't finish yet - if (_progressQuery != null && _progressQuery.Input == query.Input) + if (_progressQuery != null && _progressQuery.OriginalQuery == query.OriginalQuery) { ProgressBarVisibility = Visibility.Visible; }