aboutsummaryrefslogtreecommitdiff
path: root/terminal.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-08 09:06:13 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-08 09:06:13 +0000
commit63a50afc8e7d2b315e896f4469112f4240a1592e (patch)
tree99429f79b9df9436dcb4454c7dbd05402e03e727 /terminal.h
parentMerge branch 'xassert-performance-regression-2' (diff)
parenturl-mode: urls_render(): early exit when URL list is empty (diff)
Merge branch 'url-detection'
Diffstat (limited to 'terminal.h')
-rw-r--r--terminal.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/terminal.h b/terminal.h
index 17873c40..43dd8e03 100644
--- a/terminal.h
+++ b/terminal.h
@@ -40,7 +40,8 @@ struct attributes {
uint32_t have_fg:1;
uint32_t have_bg:1;
uint32_t selected:2;
- uint32_t reserved:3;
+ uint32_t url:1;
+ uint32_t reserved:2;
uint32_t bg:24;
};
static_assert(sizeof(struct attributes) == 8, "bad size");
@@ -211,6 +212,7 @@ enum term_surface {
TERM_SURF_SEARCH,
TERM_SURF_SCROLLBACK_INDICATOR,
TERM_SURF_RENDER_TIMER,
+ TERM_SURF_JUMP_LABEL,
TERM_SURF_TITLE,
TERM_SURF_BORDER_LEFT,
TERM_SURF_BORDER_RIGHT,
@@ -223,6 +225,17 @@ enum term_surface {
typedef tll(struct ptmx_buffer) ptmx_buffer_list_t;
+enum url_action { URL_ACTION_COPY, URL_ACTION_LAUNCH };
+struct url {
+ wchar_t *url;
+ wchar_t *text;
+ wchar_t *key;
+ struct coord start;
+ struct coord end;
+ enum url_action action;
+};
+typedef tll(struct url) url_list_t;
+
struct terminal {
struct fdm *fdm;
struct reaper *reaper;
@@ -421,6 +434,7 @@ struct terminal {
bool csd;
bool search;
bool title;
+ bool urls;
} refresh;
/* Scheduled for rendering, in the next frame callback */
@@ -429,6 +443,7 @@ struct terminal {
bool csd;
bool search;
bool title;
+ bool urls;
} pending;
bool margins; /* Someone explicitly requested a refresh of the margins */
@@ -499,6 +514,9 @@ struct terminal {
unsigned max_height; /* Maximum image height, in pixels */
} sixel;
+ url_list_t urls;
+ wchar_t url_keys[5];
+
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
struct {
bool enabled;
@@ -646,3 +664,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);