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
Move URL to yankable string conversion to urlutils #7879
base: main
Are you sure you want to change the base?
Conversation
@The-Compiler I just checked back on this and I don't know why those two tests are failing; they don't look like they're related to this PR. If they're unrelated, then is it possible to skip them somehow? |
You can ignore them for now. It looks like something broke with a Qt upgrade in an experimental environment. I'll need to take a closer look, but haven't gotten around to it yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good after an initial look. Nice isolation of the new function managed when pulling it out, changing the what arg to a boolean seems reasonable (if only to avoid having to add a new enum).
Could you have a look at changing the description of the url.yank_ignored_parameters
setting in qutebrowser/config/configdata.yml
to be more generic?
Speaking of more generic, I think there is a couple of other places this new method could be used if you are up to it:
qutebrowser/mainwindow/prompt.py::prompt_yank
- the
{url}
substitution in yank inline (try the default bindingym
)
Lastly, do you have any thoughts on the test cases in tests/end2end/features/yankpaste.feature? Are there any that are now redundant?
Proposed changelog entry: Ignored url query parameters (via url.yank_ignored_parameters
) are now respected when yanking URL via hints too (for example, via hint links yank
) (#7879)
@toofar Thanks for the feedback! I'm pretty new to the codebase so those file paths and usages of yanking were useful. I just added another commit that uses the new function in Currently I also added some new ones to cover the edge cases you proposed. Looking through |
Co-authored-by: port19 <port19@port19.xyz>
Hmm, I was thinking to just modify the
And the config param in question is
The other substitutions don't have underscores in them. There is already |
@toofar I just pushed added a new commit to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll symbolically approve it for now but try to grab a bit of @The-Compiler's time over the next week (no worries if they are too busy) to get another opinion since I don't feel too confident in this area.
Trying to recap:
- the goal of the PR is to generalize the query param stripping a bit so it applies in more places
- I asked if we could apply it in all cases!
- turns out there are some complicated places, in particular the
{url}
in command substitutions. There might be cases where you expect the verbatim URL to be used, for example when using that substitution as an argument to a userscript. So instead of changing{url}
to have query params that you probably don't care about stripped, we are introducing a{url:yank}
variable and changing the defaultym
andyM
bindings to use it. The other option I can see is changing{url}
then adding a{url:raw}
variable to get an unstripped URL. - it's not a hugely impactfull decision overall so if you don't have an opinion than that's fine too. We have a path forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good all in all! I agree that {url:yank}
is the way to go and {url}
should be left untouched.
I added a couple of nitpicks, mostly on API design things.
Co-authored-by: Florian Bruhin <me@the-compiler.org>
@The-Compiler I've added those improvements. I agree, using keyword arguments is probably better. I think everything should be all good/ready now. |
@The-Compiler Any update on this? Do you think this is ready to merge? |
Hi @michaelfm1211, maybe check back in a week? @The-Compiler is busy moving house and currently we are trying to get a 3.0.1 release out (not with all the issues in that milestone, just as much as we can) to line up with the 6.5.3 Qt release (which should be this week). That's going to be mostly fixing Qt6 regressions, so that's what we are focusing on atm. |
@The-Compiler Checking back on this a few months later. Is this PR still useful and/or in a good to merge? |
Closes #7693
As per TheCompilers' suggestion, this PR creates a
get_url_yank_text
function inqutebrowser.utils.urlutils
that takes aQUrl
(and a parameter indicating if theFormatOption.DECODE_RESERVED
flag should be used in place ofFormatOption.ENCODED
) and returns it as a string that is suitable for yanking (ie: removes passwords, ignored parameters).