Skip to content

Commit e86c712

Browse files
committed
Dont strip :code:& and :code:- from the end of URLs
Fixes #2436
1 parent e8a9935 commit e86c712

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
7272
- Workaround for bug in less that causes colors to reset at wrapped lines
7373
(:iss:`2381`)
7474

75+
- Dont strip :code:`&` and :code:`-` from the end of URLs (:iss:`2436`)
76+
7577
- Fix ``@selection`` placeholder not working with launch command (:iss:`2417`)
7678

7779
- Drop support for python 3.5

kitty/mouse.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ extend_url(Screen *screen, Line *line, index_type *x, index_type *y, char_type s
228228
while(count++ < 10) {
229229
if (*x != line->xnum - 1) break;
230230
line = screen_visual_line(screen, *y + 1);
231-
if (!line) break; // we deliberately allow non-continued lines as some programs, like mutt split URLs with newlines at line boundaries
231+
if (!line) break;
232+
// we deliberately allow non-continued lines as some programs, like
233+
// mutt split URLs with newlines at line boundaries
232234
index_type new_x = line_url_end_at(line, 0, false, sentinel);
233235
if (!new_x) break;
234236
*y += 1; *x = new_x;

kitty/unicode-data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static inline bool
2020
can_strip_from_end_of_url(uint32_t ch) {
2121
// remove trailing punctuation
2222
return (
23-
(is_P_category(ch) && ch != '/') ||
23+
(is_P_category(ch) && ch != '/' && ch != '&' && ch != '-') ||
2424
ch == '>'
2525
) ? true : false;
2626
}

kitty_tests/datatypes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ def no_url(t):
281281
l4 = create(' xxxxxtekljhgdkjgd')
282282
self.ae(l4.url_end_at(0), 0)
283283

284+
for trail in '/-&':
285+
l4 = create('http://a.b?q=1' + trail)
286+
self.ae(l4.url_end_at(1), len(l4) - 1)
287+
284288
def rewrap(self, lb, lb2):
285289
hb = HistoryBuf(lb2.ynum, lb2.xnum)
286290
cy = lb.rewrap(lb2, hb)

0 commit comments

Comments
 (0)