Merge pull request #1521 from Flow-Launcher/Shortcut

[Dev] Fix clipboard shortcut error when clipboard is empty
This commit is contained in:
VictoriousRaptor 2022-11-08 13:07:17 +08:00 committed by GitHub
commit 77fff6ca6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -622,7 +622,9 @@ namespace Flow.Launcher.ViewModel
{
_updateSource?.Cancel();
if (string.IsNullOrWhiteSpace(QueryText))
var query = ConstructQuery(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);
if (query == null) // shortcut expanded
{
Results.Clear();
Results.Visbility = Visibility.Collapsed;
@ -631,9 +633,6 @@ namespace Flow.Launcher.ViewModel
return;
}
var query = ConstructQuery(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);
_updateSource?.Dispose();
var currentUpdateSource = new CancellationTokenSource();
@ -741,6 +740,11 @@ namespace Flow.Launcher.ViewModel
private Query ConstructQuery(string queryText, IEnumerable<CustomShortcutModel> customShortcuts, IEnumerable<BuiltinShortcutModel> builtInShortcuts)
{
if (string.IsNullOrWhiteSpace(queryText))
{
return null;
}
StringBuilder queryBuilder = new(queryText);
StringBuilder queryBuilderTmp = new(queryText);