kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
23.77k stars 959 forks source link

Hovering mouse pointer over URL includes unintended characters. #6583

Closed jenstroeger closed 1 year ago

jenstroeger commented 1 year ago

Describe the bug

When hovering the mouse pointer over a URL, Kitty includes characters (in my case the ) closing bracket) that aren’t intended to be part of the URL and, clicking on it, navigates to an invalid address: https://sqlalche.me/e/14/qzyx)

However, it’s open to debate whether this really is a “bug”. Considering RFC3986 and in particular 2.2 defines ) (amongst other characters) as a sub-delims which is then a legal character for some of the url parts (section 3). Whether that applies to the HTTP scheme I’ve not yet explored.

I suspect that Kitty uses a URL regex in which case this probably can’t be imporved without taking textual context into consideration. In Python, the URL would be valid:

>>> import urllib.parse
>>> urllib.parse.urlparse('https://sqlalche.me/e/14/qzyx)')
ParseResult(scheme='https', netloc='sqlalche.me', path='/e/14/qzyx)', params='', query='', fragment='')

To Reproduce

I think this should work:

~ > echo 'https://sqlalche.me/e/14/qzyx)'
https://sqlalche.me/e/14/qzyx)

and then hover over the URLs.

Screenshots

Screenshot 2023-08-28 at 20 04 35

Environment details

kitty 0.29.2 (95316fc2dc) created by Kovid Goyal
Darwin pooh 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 x86_64
ProductName:        macOS ProductVersion:       13.5.1 BuildVersion:        22G90
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /opt/local/bin/bash
Loaded config files:
  /Users/savage/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control          yes
enabled_layouts               ['tall', 'fat', 'grid', 'horizontal', 'splits', 'stack', 'vertical']
font_family                   JetBrains Mono Light
hide_window_decorations       2
inactive_text_alpha           0.3
scrollback_lines              10000
scrollback_pager_history_size 10485760
shell_integration             frozenset({'no-cursor'})
startup_session               /Users/savage/.config/kitty/./kitty-startup-session
tab_bar_min_tabs              1
tab_bar_style                 powerline
tab_title_template            {fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{index}:{title}
window_padding_width          FloatEdges(left=2.0, top=1.0, right=2.0, bottom=1.0)
Added shortcuts:
    cmd+left →  previous_window
    cmd+right →  next_window
    shift+cmd+left →  previous_tab
    shift+cmd+right →  next_tab
Changed shortcuts:
    cmd+0 →  goto_tab 10
    cmd+1 →  goto_tab 1
    cmd+2 →  goto_tab 2
    cmd+3 →  goto_tab 3
    cmd+4 →  goto_tab 4
    cmd+5 →  goto_tab 5
    cmd+6 →  goto_tab 6
    cmd+7 →  goto_tab 7
    cmd+8 →  goto_tab 8
    cmd+9 →  goto_tab 9

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_US.UTF-8
    SHELL                               /opt/local/bin/bash
    DISPLAY                             /private/tmp/com.apple.launchd.LrDnzJQjU9/org.xquartz:0
    USER                                savage

Additional context

Try to reproduce the problem with kitty --config NONE […]

Same behavior as described above.

ad-chaos commented 1 year ago

You can use https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.url_excluded_characters

jenstroeger commented 1 year ago

Asked and answered, thank you!