mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update clipboard only if needed
We don't want to clear the clipboard if nothing is selected
This commit is contained in:
parent
705d764555
commit
2bd164f11e
1 changed files with 7 additions and 4 deletions
|
|
@ -49,18 +49,21 @@ namespace Flow.Launcher
|
|||
}
|
||||
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var _NewClipboard = QueryTextBox.SelectedText;
|
||||
|
||||
if (QueryTextBox.SelectionLength == 0)
|
||||
{
|
||||
var results = _viewModel.Results;
|
||||
var result = results.SelectedItem?.Result;
|
||||
if (result != null) // SelectedItem returns null if selection is empty.
|
||||
{
|
||||
_NewClipboard = result.Title.ToString();
|
||||
System.Windows.Clipboard.SetDataObject(result.Title.ToString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.Clipboard.SetDataObject(QueryTextBox.SelectedText;);
|
||||
}
|
||||
System.Windows.Clipboard.SetDataObject(_NewClipboard);
|
||||
e.Handled = true;
|
||||
}
|
||||
private async void OnClosing(object sender, CancelEventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue