From b1b458e91226dc59fcef9f5009c93d2712aed4b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 21 Jan 2017 19:53:33 +0530 Subject: [PATCH] When extracting URLs recognize URLs inside delimiters --- kitty/char_grid.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kitty/char_grid.py b/kitty/char_grid.py index f312485da..9b2c40b2f 100644 --- a/kitty/char_grid.py +++ b/kitty/char_grid.py @@ -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)