url-mode: use same heuristics for <> as for [] and ()

This commit is contained in:
Daniel Eklöf 2021-07-28 12:48:34 +02:00
parent ee07628291
commit 9970c2adba
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -230,6 +230,7 @@ auto_detected(const struct terminal *term, enum url_action action,
ssize_t parenthesis = 0;
ssize_t brackets = 0;
ssize_t ltgts = 0;
for (int r = 0; r < term->rows; r++) {
const struct row *row = grid_row_in_view(term->grid, r);
@ -288,7 +289,6 @@ auto_detected(const struct terminal *term, enum url_action action,
case L'/': case L'?': case L'#': case L'@': case L'!':
case L'$': case L'&': case L'\'': case L'*': case L'+':
case L',': case L';': case L'=': case L'"': case L'%':
case L'<': case L'>':
url[len++] = wc;
break;
@ -302,6 +302,11 @@ auto_detected(const struct terminal *term, enum url_action action,
url[len++] = wc;
break;
case L'<':
ltgts++;
url[len++] = wc;
break;
case L')':
if (--parenthesis < 0)
emit_url = true;
@ -316,6 +321,13 @@ auto_detected(const struct terminal *term, enum url_action action,
url[len++] = wc;
break;
case L'>':
if (--ltgts < 0)
emit_url = true;
else
url[len++] = wc;
break;
default:
emit_url = true;
break;