urls: initial support for detecting URLs and rendering jump-labels

The jump labels work, but is currently hardcoded to use xdg-open
This commit is contained in:
Daniel Eklöf 2021-01-31 11:12:07 +01:00
parent b255aea3ed
commit 2cc84db979
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
12 changed files with 503 additions and 28 deletions

View file

@ -223,6 +223,14 @@ enum term_surface {
typedef tll(struct ptmx_buffer) ptmx_buffer_list_t;
struct url {
wchar_t *url;
wchar_t *text;
wchar_t key[4];
struct coord start;
struct coord end;
};
struct terminal {
struct fdm *fdm;
struct reaper *reaper;
@ -421,6 +429,7 @@ struct terminal {
bool csd;
bool search;
bool title;
bool urls;
} refresh;
/* Scheduled for rendering, in the next frame callback */
@ -429,6 +438,7 @@ struct terminal {
bool csd;
bool search;
bool title;
bool urls;
} pending;
bool margins; /* Someone explicitly requested a refresh of the margins */
@ -499,6 +509,9 @@ struct terminal {
unsigned max_height; /* Maximum image height, in pixels */
} sixel;
tll(struct url) urls;
wchar_t url_keys[5];
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
struct {
bool enabled;
@ -646,3 +659,6 @@ void term_ime_disable(struct terminal *term);
void term_ime_reset(struct terminal *term);
void term_ime_set_cursor_rect(
struct terminal *term, int x, int y, int width, int height);
void term_urls_reset(struct terminal *term);
void term_collect_urls(struct terminal *term);