Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Flow.Launcher.Core/Plugin/QueryBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Flow.Launcher.Plugin;

Expand All @@ -14,7 +14,7 @@ public static Query Build(string input, string text, Dictionary<string, PluginPa
return new Query()
{
Search = string.Empty,
Input = string.Empty,
OriginalQuery = string.Empty,
RawQuery = string.Empty,
SearchTerms = Array.Empty<string>(),
ActionKeyword = string.Empty,
Expand Down Expand Up @@ -53,7 +53,7 @@ public static Query Build(string input, string text, Dictionary<string, PluginPa
return new Query()
{
Search = search,
Input = input,
OriginalQuery = input,
RawQuery = rawQuery,
SearchTerms = searchTerms,
ActionKeyword = actionKeyword,
Expand Down
21 changes: 17 additions & 4 deletions Flow.Launcher.Plugin/Query.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using System;
using System.Text.Json.Serialization;

namespace Flow.Launcher.Plugin
{
Expand All @@ -8,17 +9,29 @@
public class Query
{
/// <summary>
/// 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.
/// </summary>
public string Input { get; internal init; }
public string OriginalQuery { get; internal init; }

/// <summary>
/// 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.

Check warning on line 19 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`shortkeys` is not a recognized word. (unrecognized-spelling)

Check warning on line 19 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`buildin` is not a recognized word. (unrecognized-spelling)
/// We don't recommend using this property directly. You should always use Search property.
/// </summary>
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; }
}

/// <summary>
/// Original query but with trimmed whitespace. Includes action keyword.
/// It has handled buildin custom query shortkeys and build-in shortcuts.

Check warning on line 30 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`shortkeys` is not a recognized word. (unrecognized-spelling)

Check warning on line 30 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`buildin` is not a recognized word. (unrecognized-spelling)
/// 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.
/// </summary>
public string TrimmedQuery { get; internal init; }

/// <summary>
/// Determines whether the query was forced to execute again.
Expand Down Expand Up @@ -47,12 +60,12 @@
public string[] SearchTerms { get; init; }

/// <summary>
/// Query can be splited into multiple terms by whitespace

Check warning on line 63 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`splited` is not a recognized word. (unrecognized-spelling)
/// </summary>
public const string TermSeparator = " ";

/// <summary>
/// User can set multiple action keywords seperated by whitespace

Check warning on line 68 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`seperated` is not a recognized word. (unrecognized-spelling)
/// </summary>
public const string ActionKeywordSeparator = TermSeparator;

Expand Down Expand Up @@ -109,6 +122,6 @@
}

/// <inheritdoc />
public override string ToString() => RawQuery;

Check warning on line 125 in Flow.Launcher.Plugin/Query.cs

View workflow job for this annotation

GitHub Actions / build

'Query.RawQuery' is obsolete: 'RawQuery is renamed to TrimmedQUery. This property will be removed. Update the code to use TrimmedQuery instead.'
}
}
6 changes: 3 additions & 3 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
Expand All @@ -24,7 +24,7 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using iNKORE.UI.WPF.Modern;

Check warning on line 27 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using Microsoft.VisualStudio.Threading;

namespace Flow.Launcher.ViewModel
Expand Down Expand Up @@ -271,7 +271,7 @@
#if DEBUG
throw t.Exception;
#else
App.API.LogError(ClassName, $"Error happen in task dealing with viewupdate for results. {t.Exception}");

Check warning on line 274 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`viewupdate` is not a recognized word. (unrecognized-spelling)
_resultsViewUpdateTask =
Task.Run(UpdateActionAsync).ContinueWith(continueAction, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
#endif
Expand All @@ -284,7 +284,7 @@

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;
}
Expand Down Expand Up @@ -1470,7 +1470,7 @@
_ = 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;
}
Expand Down
Loading