Fix URL detection regression on lines with NUL bytes

Commit 859b4c89 (url-mode: wip: more work on regex matching,
2025-01-30) regressed URL detection in weechat. Some of the URLs
still work but others don't. This is because regexec() stops at the
first NUL, thus skipping the rest of the line. weechat seems create
NUL cells between their UI widgets.

Work around this by replacing NUL with space. This is probably correct
because selecting and copying those cells also translates to space
(not sure where in the code).
This commit is contained in:
Johannes Altmanninger 2025-02-09 09:11:27 +01:00 committed by Daniel Eklöf
parent 325086291b
commit 4e5ad6e013
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -368,7 +368,8 @@ regex_detected(const struct terminal *term, enum url_action action,
vline->sz = new_size;
}
vline->utf8[vline->len + j] = buf[j];
vline->utf8[vline->len + j] =
(buf[j] == '\0') ? ' ' : buf[j];
vline->map[vline->len + j] = (struct coord){c, term->grid->view + r};
}