mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
url-mode: underline URLs using the color from colors.urls
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.
This commit is contained in:
parent
6726494f4c
commit
2c10a147ea
6 changed files with 61 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ static inline bool urls_mode_is_active(const struct terminal *term)
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue