url-mode: store URL in UTF-8, not UTF-32

The only time the URL is actually in UTF-32 is when we’re collecting
it (auto-detecting it) from the grid, since cells store their
character(s) in UTF-32.

Everything *after* that prefers the URL in UTF-8. So, do the
conversion while collecting the URL.

This patch also changes the URL activation code to strip the
‘file://user@host/’ prefix from file URIs that refer to files
on the *local* computer.
This commit is contained in:
Daniel Eklöf 2021-02-13 12:28:53 +01:00
parent 0bda60aacc
commit 3339915d20
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 61 additions and 44 deletions

View file

@ -227,7 +227,7 @@ typedef tll(struct ptmx_buffer) ptmx_buffer_list_t;
enum url_action { URL_ACTION_COPY, URL_ACTION_LAUNCH };
struct url {
wchar_t *url;
char *url;
wchar_t *text;
wchar_t *key;
struct coord start;