mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05: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
15
config.c
15
config.c
|
|
@ -791,6 +791,19 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
return false;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "osc8-underline") == 0) {
|
||||
if (strcmp(value, "url-mode") == 0)
|
||||
conf->osc8_underline = OSC8_UNDERLINE_URL_MODE;
|
||||
else if (strcmp(value, "always") == 0)
|
||||
conf->osc8_underline = OSC8_UNDERLINE_URL_MODE;
|
||||
else {
|
||||
LOG_AND_NOTIFY_ERR(
|
||||
"%s:%u: [default]: %s: invalid 'osc8-underline'; "
|
||||
"must be one of 'url-mode', or 'always'", path, lineno, value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
LOG_AND_NOTIFY_ERR("%s:%u: [default]: %s: invalid key", path, lineno, key);
|
||||
return false;
|
||||
|
|
@ -2243,6 +2256,8 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.argv = NULL,
|
||||
},
|
||||
|
||||
.osc8_underline = OSC8_UNDERLINE_ALWAYS,
|
||||
|
||||
.tweak = {
|
||||
.fcft_filter = FCFT_SCALING_FILTER_LANCZOS3,
|
||||
.allow_overflowing_double_width_glyphs = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue