mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-04 06:36:24 +00:00
When extracting URLs recognize URLs inside delimiters
This commit is contained in:
parent
107b395621
commit
b1b458e912
1 changed files with 5 additions and 0 deletions
|
|
@ -372,6 +372,11 @@ class CharGrid:
|
|||
for m in self.url_pat.finditer(text):
|
||||
if m.start() <= x < m.end():
|
||||
url = ''.join(l[i] for i in range(*m.span())).rstrip('.')
|
||||
if m.start() > 0:
|
||||
before = l[m.start() - 1]
|
||||
closing = {'(': ')', '[': ']', '{': '}', '<': '>', '"': '"', "'": "'", '`': '`', '|': '|', ':': ':'}.get(before)
|
||||
if closing is not None and url.endswith(closing):
|
||||
url = url[:-1]
|
||||
if url:
|
||||
open_url(url, self.opts.open_url_with)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue