From 19001a459ee55391423d9c27335ce119b095d526 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 8 Sep 2022 16:09:57 +0900 Subject: [PATCH 01/16] Add Drag Test Code --- Flow.Launcher/MainWindow.xaml | 4 ++- Flow.Launcher/MainWindow.xaml.cs | 53 ++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 714fcc53f..957e942dc 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -264,7 +264,9 @@ + MouseMove="FileView_MouseMove" + PreviewMouseLeftButtonDown="FileView_PreviewMouseLeftButtonDown" + PreviewMouseLeftButtonUp="OnPreviewMouseButtonDown" /> diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 2b7db38cf..53928f2ed 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using System.Windows; @@ -20,6 +20,9 @@ using Flow.Launcher.Infrastructure; using System.Windows.Media; using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin.SharedCommands; +using System.Text; +using DataObject = System.Windows.DataObject; +using System.Diagnostics; namespace Flow.Launcher { @@ -383,6 +386,52 @@ namespace Flow.Launcher e.Handled = true; } + private Point start; + + private void FileView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + this.start = e.GetPosition(null); + } + + private void FileView_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) + { + Point mpos = e.GetPosition(null); + Vector diff = this.start - mpos; + + if (e.LeftButton == MouseButtonState.Pressed && + Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance && + Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance) + { + + if (this.ResultListBox.SelectedItems.Count == 0) + { + return; + } + + var r = (ResultListBox)sender; + var d = (DependencyObject)e.OriginalSource; + var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; + var result = (ResultViewModel)item?.DataContext; + Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + Console.WriteLine("result"); + + // right about here you get the file urls of the selected items. + // should be quite easy, if not, ask. + //string[] files = "asdf.txt"; + + string path = @"D:\test.png"; + string[] files = { path }; + var data = new DataObject(System.Windows.DataFormats.FileDrop, files); + data.SetData(System.Windows.DataFormats.Text, files[0]); + DragDrop.DoDragDrop(this, data, System.Windows.DragDropEffects.Copy); + e.Handled = true; + // string dataFormat = System.Windows.DataFormats.FileDrop; + //System.Windows.DataObject dataObject = new System.Windows.DataObject(dataFormat, files); + //DragDrop.DoDragDrop(this.ResultListBox, dataObject, System.Windows.DragDropEffects.Copy); + } + } + + private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs e) { _viewModel.Hide(); @@ -556,4 +605,4 @@ namespace Flow.Launcher } } } -} \ No newline at end of file +} From 3e128e1a9a53c77c5ec5fdd3c712b89546bec65f Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 28 Sep 2022 15:06:14 +0900 Subject: [PATCH 02/16] Changed listitem to draggable --- Flow.Launcher/ResultListBox.xaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 2c78f9bab..d0a5247a5 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -120,6 +120,7 @@ x:Name="Title" VerticalAlignment="Center" DockPanel.Dock="Left" + IsHitTestVisible="False" Style="{DynamicResource ItemTitleStyle}" Text="{Binding Result.Title}" ToolTip="{Binding ShowTitleToolTip}"> @@ -133,6 +134,7 @@ From dde5a513d35b366eef9ab4c511f5d3b032b1ff69 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 29 Sep 2022 00:02:49 +0900 Subject: [PATCH 03/16] Adjust Drag and drop code --- Flow.Launcher/MainWindow.xaml.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 53928f2ed..a35f35a45 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -23,6 +23,8 @@ using Flow.Launcher.Plugin.SharedCommands; using System.Text; using DataObject = System.Windows.DataObject; using System.Diagnostics; +using Microsoft.AspNetCore.Http; +using System.IO; namespace Flow.Launcher { @@ -412,22 +414,19 @@ namespace Flow.Launcher var d = (DependencyObject)e.OriginalSource; var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; var result = (ResultViewModel)item?.DataContext; - Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - Console.WriteLine("result"); - // right about here you get the file urls of the selected items. - // should be quite easy, if not, ask. - //string[] files = "asdf.txt"; - string path = @"D:\test.png"; + string copyText = string.IsNullOrEmpty(result.Result.CopyText) ? result.Result.SubTitle : result.Result.CopyText; + var isFile = File.Exists(copyText); + var isFolder = Directory.Exists(copyText); + + //string path = @"D:\test.png"; + string path = Convert.ToString(copyText); string[] files = { path }; var data = new DataObject(System.Windows.DataFormats.FileDrop, files); - data.SetData(System.Windows.DataFormats.Text, files[0]); - DragDrop.DoDragDrop(this, data, System.Windows.DragDropEffects.Copy); + //data.SetData(System.Windows.DataFormats.FileDrop, files[0]); + DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy); e.Handled = true; - // string dataFormat = System.Windows.DataFormats.FileDrop; - //System.Windows.DataObject dataObject = new System.Windows.DataObject(dataFormat, files); - //DragDrop.DoDragDrop(this.ResultListBox, dataObject, System.Windows.DragDropEffects.Copy); } } From d0c281ef359d868dbfa372f5a506b2734a8847a4 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 29 Sep 2022 01:11:20 +0900 Subject: [PATCH 04/16] - Add "Move" - Adjust Function Name --- Flow.Launcher/MainWindow.xaml | 4 ++-- Flow.Launcher/MainWindow.xaml.cs | 36 +++++++++++++------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 957e942dc..f68934ebf 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -264,8 +264,8 @@ diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a35f35a45..6e1ff94b3 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -390,42 +390,34 @@ namespace Flow.Launcher private Point start; - private void FileView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.start = e.GetPosition(null); } - private void FileView_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) + private void ResultList_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { + if (this.ResultListBox.SelectedItems.Count == 0) + { + return; + } + Point mpos = e.GetPosition(null); Vector diff = this.start - mpos; + var r = (ResultListBox)sender; + var d = (DependencyObject)e.OriginalSource; + var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; + var result = (ResultViewModel)item?.DataContext; + if (e.LeftButton == MouseButtonState.Pressed && Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance && Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance) { - - if (this.ResultListBox.SelectedItems.Count == 0) - { - return; - } - - var r = (ResultListBox)sender; - var d = (DependencyObject)e.OriginalSource; - var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; - var result = (ResultViewModel)item?.DataContext; - - string copyText = string.IsNullOrEmpty(result.Result.CopyText) ? result.Result.SubTitle : result.Result.CopyText; - var isFile = File.Exists(copyText); - var isFolder = Directory.Exists(copyText); - - //string path = @"D:\test.png"; - string path = Convert.ToString(copyText); - string[] files = { path }; + string[] files = { copyText }; var data = new DataObject(System.Windows.DataFormats.FileDrop, files); - //data.SetData(System.Windows.DataFormats.FileDrop, files[0]); - DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy); + DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy | System.Windows.DragDropEffects.Move); e.Handled = true; } } From 74999006a5506676d0111caf8b0eeb83e294a542 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 29 Sep 2022 18:04:15 +0900 Subject: [PATCH 05/16] Change the default drag action to copy (shift+drag to move) --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6e1ff94b3..10fadd591 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -417,7 +417,7 @@ namespace Flow.Launcher string copyText = string.IsNullOrEmpty(result.Result.CopyText) ? result.Result.SubTitle : result.Result.CopyText; string[] files = { copyText }; var data = new DataObject(System.Windows.DataFormats.FileDrop, files); - DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy | System.Windows.DragDropEffects.Move); + DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Move | System.Windows.DragDropEffects.Copy); e.Handled = true; } } From 4a15263a1ee974576c8c9ccafff3d837770cb85a Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 22 Oct 2022 11:25:26 +0900 Subject: [PATCH 06/16] Changed the Icon 'IsHitTestVisible' --- Flow.Launcher/ResultListBox.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 3737a7ade..869045526 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -84,7 +84,7 @@ x:Name="ImageIcon" Width="{Binding IconXY}" Height="{Binding IconXY}" - Margin="0,0,0,0" + Margin="0,0,0,0" IsHitTestVisible="False" HorizontalAlignment="Center" Source="{Binding Image, TargetNullValue={x:Null}}" Stretch="Uniform" From 234156b15371e4b70998ce5027753e58eb316e2b Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sun, 23 Oct 2022 18:04:25 -0400 Subject: [PATCH 07/16] Move code to ResultListBox to avoid extra children retrieval. Adjust the CopyText property to automatically return Subtitle is not specified --- Flow.Launcher.Plugin/Result.cs | 7 +++- Flow.Launcher/MainWindow.xaml | 2 - Flow.Launcher/MainWindow.xaml.cs | 35 ---------------- Flow.Launcher/ResultListBox.xaml | 7 +++- Flow.Launcher/ResultListBox.xaml.cs | 51 ++++++++++++++++++++++-- Flow.Launcher/ViewModel/MainViewModel.cs | 18 ++++----- 6 files changed, 66 insertions(+), 54 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 7633e34a7..a1d3b83ab 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -37,7 +37,11 @@ namespace Flow.Launcher.Plugin /// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path /// flow will copy the actual file/folder instead of just the path text. /// - public string CopyText { get; set; } = string.Empty; + public string CopyText + { + get => string.IsNullOrEmpty(_copyText) ? SubTitle : _copyText; + set => _copyText = value; + } /// /// This holds the text which can be provided by plugin to help Flow autocomplete text @@ -81,6 +85,7 @@ namespace Flow.Launcher.Plugin /// Delegate to Get Image Source /// public IconDelegate Icon; + private string _copyText = string.Empty; /// /// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 006d394fe..3e89ae5e0 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -288,8 +288,6 @@ diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index ac0393855..72fd97b3b 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -374,41 +374,6 @@ namespace Flow.Launcher e.Handled = true; } - private Point start; - - private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - this.start = e.GetPosition(null); - } - - private void ResultList_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) - { - if (this.ResultListBox.SelectedItems.Count == 0) - { - return; - } - - Point mpos = e.GetPosition(null); - Vector diff = this.start - mpos; - - var r = (ResultListBox)sender; - var d = (DependencyObject)e.OriginalSource; - var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; - var result = (ResultViewModel)item?.DataContext; - - if (e.LeftButton == MouseButtonState.Pressed && - Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance && - Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance) - { - string copyText = string.IsNullOrEmpty(result.Result.CopyText) ? result.Result.SubTitle : result.Result.CopyText; - string[] files = { copyText }; - var data = new DataObject(System.Windows.DataFormats.FileDrop, files); - DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Move | System.Windows.DragDropEffects.Copy); - e.Handled = true; - } - } - - private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs e) { _viewModel.Hide(); diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 869045526..1ece390d1 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -25,12 +25,15 @@ VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard" Visibility="{Binding Visbility}" - mc:Ignorable="d"> + mc:Ignorable="d" + PreviewMouseMove="ResultList_MouseMove" + PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown"> - [TestCase(Chrome, Chrome, 157)] - [TestCase(Chrome, LastIsChrome, 147)] + [TestCase(Chrome, LastIsChrome, 145)] [TestCase("chro", HelpCureHopeRaiseOnMindEntityChrome, 50)] [TestCase("chr", HelpCureHopeRaiseOnMindEntityChrome, 30)] [TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, 21)] [TestCase(Chrome, CandyCrushSagaFromKing, 0)] - [TestCase("sql", MicrosoftSqlServerManagementStudio, 110)] - [TestCase("sql manag", MicrosoftSqlServerManagementStudio, 121)] //double spacing intended + [TestCase("sql", MicrosoftSqlServerManagementStudio, 109)] + [TestCase("sql manag", MicrosoftSqlServerManagementStudio, 120)] //double spacing intended public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring( string queryString, string compareString, int expectedScore) { @@ -284,6 +284,38 @@ namespace Flow.Launcher.Test $"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}"); } + [TestCase("red", "red colour", "metro red")] + [TestCase("red", "this red colour", "this colour red")] + [TestCase("red", "this red colour", "this colour is very red")] + [TestCase("red", "this red colour", "this colour is surprisingly super awesome red and cool")] + public void WhenGivenTwoStrings_Scoring_ShouldGiveMoreWeightToTheStringCloserToIndexZero( + string queryString, string compareString1, string compareString2) + { + // When + var matcher = new StringMatcher { UserSettingSearchPrecision = SearchPrecisionScore.Regular }; + + // Given + var compareString1Result = matcher.FuzzyMatch(queryString, compareString1); + var compareString2Result = matcher.FuzzyMatch(queryString, compareString2); + + Debug.WriteLine(""); + Debug.WriteLine("###############################################"); + Debug.WriteLine($"QueryString: \"{queryString}\"{Environment.NewLine}"); + Debug.WriteLine( + $"CompareString1: \"{compareString1}\", Score: {compareString1Result.Score}{Environment.NewLine}"); + Debug.WriteLine( + $"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}"); + Debug.WriteLine("###############################################"); + Debug.WriteLine(""); + + // Should + Assert.True(compareString1Result.Score > compareString2Result.Score, + $"Query: \"{queryString}\"{Environment.NewLine} " + + $"CompareString1: \"{compareString1}\", Score: {compareString1Result.Score}{Environment.NewLine}" + + $"Should be greater than{Environment.NewLine}" + + $"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}"); + } + [TestCase("vim", "Vim", "ignoreDescription", "ignore.exe", "Vim Diff", "ignoreDescription", "ignore.exe")] public void WhenMultipleResults_ExactMatchingResult_ShouldHaveGreatestScore( string queryString, string firstName, string firstDescription, string firstExecutableName, From 92a9662671222bd5c70dcb6e62f00b5c69db7555 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 4 Nov 2022 22:38:38 +1100 Subject: [PATCH 13/16] add testing for tail end string match --- Flow.Launcher.Test/FuzzyMatcherTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.Test/FuzzyMatcherTest.cs b/Flow.Launcher.Test/FuzzyMatcherTest.cs index d489b8104..46c848c7a 100644 --- a/Flow.Launcher.Test/FuzzyMatcherTest.cs +++ b/Flow.Launcher.Test/FuzzyMatcherTest.cs @@ -288,6 +288,7 @@ namespace Flow.Launcher.Test [TestCase("red", "this red colour", "this colour red")] [TestCase("red", "this red colour", "this colour is very red")] [TestCase("red", "this red colour", "this colour is surprisingly super awesome red and cool")] + [TestCase("red", "this colour is surprisingly super red very and cool", "this colour is surprisingly super very red and cool")] public void WhenGivenTwoStrings_Scoring_ShouldGiveMoreWeightToTheStringCloserToIndexZero( string queryString, string compareString1, string compareString2) { From b47206e359cfc7beed6855f9aafd6232a2a39039 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 7 Nov 2022 20:34:26 +1100 Subject: [PATCH 14/16] add requery to refresh the results after drag --- Flow.Launcher/ResultListBox.xaml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs index a0ffc159a..734165f74 100644 --- a/Flow.Launcher/ResultListBox.xaml.cs +++ b/Flow.Launcher/ResultListBox.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Windows; using System.Windows.Controls; @@ -61,6 +61,7 @@ namespace Flow.Launcher private Point start; private string file; + private string query; private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { @@ -68,6 +69,7 @@ namespace Flow.Launcher return; file = result.Result.CopyText; + query = result.Result.OriginQuery.RawQuery; start = e.GetPosition(null); } @@ -93,6 +95,7 @@ namespace Flow.Launcher file }); DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy); + App.API.ChangeQuery(query, true); e.Handled = true; } } From 9bbd01a1d73103e738ad99db7fc0f0c1ea2d1345 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 7 Nov 2022 21:10:05 +1100 Subject: [PATCH 15/16] add drag and drop for folders --- Flow.Launcher/ResultListBox.xaml.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs index 734165f74..8a8ef3ab3 100644 --- a/Flow.Launcher/ResultListBox.xaml.cs +++ b/Flow.Launcher/ResultListBox.xaml.cs @@ -60,7 +60,7 @@ namespace Flow.Launcher private Point start; - private string file; + private string path; private string query; private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) @@ -68,7 +68,7 @@ namespace Flow.Launcher if (Mouse.DirectlyOver is not FrameworkElement { DataContext: ResultViewModel result }) return; - file = result.Result.CopyText; + path = result.Result.CopyText; query = result.Result.OriginQuery.RawQuery; start = e.GetPosition(null); } @@ -78,24 +78,28 @@ namespace Flow.Launcher if (e.LeftButton != MouseButtonState.Pressed) { start = default; - file = null; + path = null; return; } + if (!File.Exists(path) && !Directory.Exists(path)) + return; + Point mousePosition = e.GetPosition(null); Vector diff = this.start - mousePosition; if (Math.Abs(diff.X) < SystemParameters.MinimumHorizontalDragDistance - || Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance - || !File.Exists(file)) + || Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance) return; var data = new DataObject(DataFormats.FileDrop, new[] { - file + path }); DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy); + App.API.ChangeQuery(query, true); + e.Handled = true; } } From 6efd28874f7c09e804258e26db855313f2f6db76 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 7 Nov 2022 21:34:22 +1100 Subject: [PATCH 16/16] add reset for query string --- Flow.Launcher/ResultListBox.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs index 8a8ef3ab3..d1415f8ab 100644 --- a/Flow.Launcher/ResultListBox.xaml.cs +++ b/Flow.Launcher/ResultListBox.xaml.cs @@ -78,7 +78,8 @@ namespace Flow.Launcher if (e.LeftButton != MouseButtonState.Pressed) { start = default; - path = null; + path = string.Empty; + query = string.Empty; return; }