mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-14 04:27:57 -05:00
This is implemented by allocating one of the (few!) remaining bits in the cells’ attribute struct to indicate the cell should be “URL highlighted”. render_cell() looks at this bit and draws an underline using the color from colors.urls (defaults to regular3 - i.e. yellow). A new function, url_tag_cells(), iterates the currently detected URLs and sets the new ‘url’ attribute flag on the affected cells. Note: this is done in a separate function to keep urls_collect() free from as many dependencies as possible. urls_reset() is updated to *clear* the ‘url’ flag (and thus implicitly also results in a grid refresh, _if_ there were any URLs). We now exit URL mode on *any* client application input. This needs to be so since we can’t know if the URLs we previously detected are still valid.
19 lines
520 B
C
19 lines
520 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <xkbcommon/xkbcommon.h>
|
|
#include <tllist.h>
|
|
|
|
#include "terminal.h"
|
|
|
|
static inline bool urls_mode_is_active(const struct terminal *term)
|
|
{
|
|
return tll_length(term->urls) > 0;
|
|
}
|
|
|
|
void urls_collect(struct terminal *term, enum url_action action);
|
|
void urls_tag_cells(struct terminal *term);
|
|
void urls_reset(struct terminal *term);
|
|
|
|
void urls_input(struct seat *seat, struct terminal *term, uint32_t key,
|
|
xkb_keysym_t sym, xkb_mod_mask_t mods, uint32_t serial);
|