Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edited the google search plugin to include multi line searches #1428

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thealmightychuck
Copy link

@thealmightychuck thealmightychuck commented Dec 1, 2023

Just starting to learn to contribute to other projects. So I have no idea if I'm doing this correctly.
Fixes #1427 - Fixed the issue of now allowing google searches with multiple lines selected
Edited line 19 in plugins/google_search.py to include an additional conditional with multiple lines

@Akuli
Copy link
Owner

Akuli commented Dec 1, 2023

Thanks for working on this!

As I wrote in the issue, you probably don't want to actually google multiple lines. For example, let's say someone selects all text in the whole file, right-click, and accidentally click the googling button. We don't want to send a google search that is hundreds of lines long.

A better fix would be to modify the add_rightclick_option() function, so that there's some way to disallow multiple lines. For example, it could look like this:

    rightclick_menu.add_rightclick_option(
        "Search selected text on Google", google_search, needs_selected_text_single_line=True
    )

where needs_selected_text_single_line=True would be a new parameter that you would add to the function.

This will need several things to be changed in rightclick_menu.py. Let me know if you need help :)

@thealmightychuck
Copy link
Author

So we could still have the feature if someone wanted it, but have it optional and set it to disabled by default? I'll look into rightclick_menu.py to see what would need to be changed.

@Akuli
Copy link
Owner

Akuli commented Dec 2, 2023

I don't think anyone wants to google multiple lines at once. We can change it later if someone actually makes an issue and asks for it.

@Moosems
Copy link
Contributor

Moosems commented Dec 3, 2023

You can Google with newlines?

@rdbende
Copy link
Collaborator

rdbende commented Dec 3, 2023

Google will replace it with a space, but yes, this is a completely valid search query: https://www.google.com/search?q=foo%0Abar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Search selected text on Google" can be done for multiline text
4 participants