mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Fix hover detection of URLs not working when hovering over the first colon and slash characters in short URLs
Fixes #1201
This commit is contained in:
parent
d5366a421f
commit
47ec372c30
@ -97,6 +97,9 @@ Changelog
|
||||
|
||||
- Follow xterm's behavior for the menu key (:iss:`597`)
|
||||
|
||||
- Fix hover detection of URLs not working when hovering over the first colon
|
||||
and slash characters in short URLs (:iss:`1201`)
|
||||
|
||||
0.12.3 [2018-09-29]
|
||||
------------------------------
|
||||
|
||||
|
@ -62,6 +62,13 @@ find_colon_slash(Line *self, index_type x, index_type limit) {
|
||||
do {
|
||||
char_type ch = self->cpu_cells[pos].ch;
|
||||
if (!is_url_char(ch)) return false;
|
||||
if (pos == x) {
|
||||
if (ch == ':') {
|
||||
if (pos + 2 < self->xnum && self->cpu_cells[pos+1].ch == '/' && self->cpu_cells[pos + 2].ch == '/') state = SECOND_SLASH;
|
||||
} else if (ch == '/') {
|
||||
if (pos + 1 < self->xnum && self->cpu_cells[pos+1].ch == '/') state = FIRST_SLASH;
|
||||
}
|
||||
}
|
||||
switch(state) {
|
||||
case ANY:
|
||||
if (ch == '/') state = FIRST_SLASH;
|
||||
|
@ -242,6 +242,9 @@ class TestDataTypes(BaseTest):
|
||||
self.ae(l0.url_end_at(0), len(l0) - 1)
|
||||
l2 = create("http://-abcd] ")
|
||||
self.ae(l2.url_end_at(0), len(l2) - 3)
|
||||
l3 = create("http://ab.de ")
|
||||
self.ae(l3.url_start_at(4), 0)
|
||||
self.ae(l3.url_start_at(5), 0)
|
||||
|
||||
def lspace_test(n, scheme='http'):
|
||||
lf = create(' ' * n + scheme + '://acme.com')
|
||||
|
Loading…
Reference in New Issue
Block a user