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
URLs with parentheses are not clickable #1196
Comments
URL selection follows the same pattern as word selection, so this request is a bit tricky; I don't think you'd like to select "abc (def)" as one word with double-click. You can adapt the character set with option WordChars for experimenting. |
Rather than "abc (def)" it's actually "abc_(def)" with an underscore. But the URL selection stops at the first opening parenthesis. I think if a parenthesis follows an underscore or non-whitespace character, the URL selection ought to consider those parentheses as part of the URL. Looking at the documentation for WordChars, it says "By default, this string setting is empty, in which case double-click word selection uses the default algorithm that is geared towards picking out file names and URLs." Since parentheses are valid characters in URLs and can be valid in filenames too if quoted, then parentheses that follow an underscore or non-whitespace characters ought to be included as part of the word. In the meantime, I've set |
An example URL would be https://en.wikipedia.org/wiki/Class_(set_theory) |
It wasn't actually too tricky to distinguish URL and word selection. I've uploaded a tweak that allows parentheses (also square and curly) in URLs. |
Thank you! Please do not include <> in URLs -- these characters are often used to wrap URLs to identify them as URLs in some text files and IRC channels, i.e. It seems that https://www.rfc-editor.org/rfc/rfc3986#section-2 means that |
It would be ideal if the URL-specific pattern could ignore or discard trailing |
|
OK, you say trailing |
I mentioned Ignoring or stripping certain trailing punctuation would be very helpful. The specific subset I listed, It is extremely, extremely rare to see one of |
I've stumbled up on a related issue. Given a URL like https://metacpan.org/pod/Thread::Csp, if I mouse-over the URL the whole thing underlines. But if I click the URL before the If I click on the URL after the |
If I hover or click before |
I suspect it is the |
hey @pragma- , what's your use case for this? depending on use case, the urls may also be following by closing parenthesis, which will require even more tuning to get right. but thankfully, the situation i am thinking of for that doesn't generally have to deal with terminals so, i am interested to know what is your use case for urls in terminal? |
@yashpalgoyal1304 Mostly IRC. But also manpages, READMEs, comments in source files, and more. |
If the URL is followed by a closing parenthesis but does not contain an opening parenthesis, then the closing parenthesis ought to be discarded/ignored, I think? I personally have never ever seen a URL that has a |
Perhaps instead of trying to hardcode a URL parser it may make sense instead to use a lightweight regexp library and expose a URL regex option so users can configure their own regexes for matching URLs, as many popular terminal emulators do? |
no, i meant like this: |
Another URL with weird hover/click behavior: https://encrypted-tbn0.gstatic.com/images?q=tbn:therestoftheurl&usqp=CAU If I mouse-over the part before the Screen recording: https://i.imgur.com/jYdsyAv.mp4 |
(Such issues can easily be reproduced, screen recording not needed.) |
I addressed how to easily disambiguate a URL with a (...) section vs a URL wrapped in parentheses already. Disappointing. |
just sharing for reference:
|
If it's so easy, you are welcome to propose an implementation. |
Source MIT so cloneable. |
@yashpalgoyal1304 I've switched to wezterm. See https://github.com/pragma-/dotfiles/blob/c6c9498f53f812ea872fdf94e044f63956862756/wezterm/wezterm.lua#L70-L85 for how I have URLs clickable in exactly the way I want. edit: Updated URL regexes to be more robust. |
@yashpalgoyal1304 also note https://github.com/pragma-/dotfiles/blob/c6c9498f53f812ea872fdf94e044f63956862756/wezterm/wezterm.lua#L9 for starting Cygwin instead of CMD. wezterm supports WSL, as well, but I don't use that. |
so, u dont use Msys2? i have just set my Environment variable |
@yashpalgoyal1304 Nice! No, I like Cygwin's package manager and the ease it provides me in installing other things. I use |
URLs are now matched with proper detection of parentheses nesting. |
The current patch also fixes the inconsistency around |
I previously closed this issue as |
It could be considered done for now, unless parentheses style matching is desired or someone finds another problem with it. |
Released 3.6.4. |
Related: #1208 |
Hello again!
Thanks for the work on
OpeningMod
to support clickable URLs. It's been working wonderfully!I've been noticing a minor annoyance with URLs that contain parentheses, notably Wikipedia URLs. Would it be possible to include parentheses in the URL regex? Perhaps even an option to expose the regex as a configurable item if you're willing to go that far.
The text was updated successfully, but these errors were encountered: