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

Match URL allowed characters in hints mode #7095

Closed
kevinywlui opened this issue Feb 5, 2024 · 0 comments
Closed

Match URL allowed characters in hints mode #7095

kevinywlui opened this issue Feb 5, 2024 · 0 comments

Comments

@kevinywlui
Copy link

Is your feature request related to a problem? Please describe.

I often run into <foo http://example.com> in my terminal and would like to open http://example.com in hints mode. This matches http://example.com> which is an invalid URL.

Describe the solution you'd like

The allowed URI characters are described in https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax. This excludes > as an allowed character.

I propose that URL matching should only consider valid URI characters.

Note that the current logic is at https://github.com/kovidgoyal/kitty/blob/master/kittens/hints/marks.go#L248C90-L248C104 which expands to (?:gopher|http|ircs|mailto|news|ssh|ftps|https|ftp|gemini|git|sftp|file|irc|kitty)://[^\x00-\x09\x0b-\x0c\x0e-\x20\x7f-\xa0\xad\x{600}-\x{605}\x{61c}\x{6dd}\x{70f}\x{890}-\x{891}\x{8e2}\x{1680}\x{180e}\x{2000}-\x{200f}\x{2028}-\x{202f}\x{205f}-\x{2064}\x{2066}-\x{206f}\x{3000}\x{d800}-\x{f8ff}\x{feff}\x{fff9}-\x{fffb}\x{110bd}\x{110cd}\x{13430}-\x{1343f}\x{1bca0}-\x{1bca3}\x{1d173}-\x{1d17a}\x{e0001}\x{e0020}-\x{e007f}\x{f0000}-\x{ffffd}\x{100000}-\x{10fffd}]{3,}

Describe alternatives you've considered

There is an existing feature https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.url_excluded_characters which handles URL under the cursor. Ideally, there would be synergy between URLs in hints-mode and URLs-under-cursor, but it appears there currently isn't.

Additionally, I think URL matching only valid URL characters is a reasonable default behavior.

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

No branches or pull requests

1 participant