mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-10 05:33:51 -04:00
urls: OSC-8 URLs can now optionally be underlined outside of url-mode
This patch adds a new configuration option, ‘osc8-underline=url-mode|always’. When set to ‘url-mode’, OSC-8 URLs are only highlighted (i.e. underlined) in url-mode, just like auto-detected URLs. When set to ‘always’, they are always underlined, regardless of mode, and regardless of their other attributes. This is implemented by tagging collected URLs with a boolean, instructing urls_render() and urls_reset() whether they should update the cells’ ‘url’ attribute or not. The OSC-8 collecter sets this based on the value of ‘osc8-underline’. Finally, when closing an OSC-8 URL, the cells are immediately tagged with the ‘url’ attribute if ‘osc8-underline’ is set to ‘always’.
This commit is contained in:
parent
a0b977fcee
commit
2074f8b656
7 changed files with 65 additions and 3 deletions
14
terminal.c
14
terminal.c
|
|
@ -3049,13 +3049,25 @@ term_osc8_close(struct terminal *term)
|
|||
do {
|
||||
int end_col = r == end.row ? end.col : term->cols - 1;
|
||||
|
||||
struct row *row = term->grid->rows[r];
|
||||
|
||||
switch (term->conf->osc8_underline) {
|
||||
case OSC8_UNDERLINE_ALWAYS:
|
||||
for (int c = start_col; c <= end_col; c++)
|
||||
row->cells[c].attrs.url = true;
|
||||
break;
|
||||
|
||||
case OSC8_UNDERLINE_URL_MODE:
|
||||
break;
|
||||
}
|
||||
|
||||
struct row_uri_range range = {
|
||||
.start = start_col,
|
||||
.end = end_col,
|
||||
.id = term->vt.osc8.id,
|
||||
.uri = xstrdup(term->vt.osc8.uri),
|
||||
};
|
||||
grid_row_add_uri_range(term->grid->rows[r], range);
|
||||
grid_row_add_uri_range(row, range);
|
||||
start_col = 0;
|
||||
} while (r++ != end.row);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue