Add uppercase-regex-insert config option.

Fixes #2159.

This makes the "uppercase hint character inserts selected text" behavior
added in #1975 configurable, as it can have unexpected behavior for some users.

It defaults to "off", preserving the original behavior of `foot` before #1975.
This commit is contained in:
Ryan Roden-Corrent 2025-08-07 08:18:38 -04:00
parent 72d9a13c0c
commit 2a796d77e3
No known key found for this signature in database
GPG key ID: 435D8B10692555C9
6 changed files with 21 additions and 1 deletions

View file

@ -67,6 +67,13 @@
## Unreleased ## Unreleased
### Added ### Added
* The `uppercase-regex-insert` option controls whether an uppercase hint
character will insert the selected text into the prompt in `regex-copy`
or `show-urls-copy` mode. ([#2159]2159[]).
[2159]: https://codeberg.org/dnkl/foot/issues/2159
### Changed ### Changed
* The label letters are no longer sorted before being assigned to URLs * The label letters are no longer sorted before being assigned to URLs

View file

@ -1111,6 +1111,9 @@ parse_section_main(struct context *ctx)
(int *)&conf->initial_color_theme); (int *)&conf->initial_color_theme);
} }
else if (streq(key, "uppercase-regex-insert"))
return value_to_bool(ctx, &conf->uppercase_regex_insert);
else { else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key); LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
return false; return false;
@ -3375,6 +3378,7 @@ config_load(struct config *conf, const char *conf_path,
.strikeout_thickness = {.pt = 0., .px = -1}, .strikeout_thickness = {.pt = 0., .px = -1},
.dpi_aware = false, .dpi_aware = false,
.gamma_correct = false, .gamma_correct = false,
.uppercase_regex_insert = false,
.security = { .security = {
.osc52 = OSC52_ENABLED, .osc52 = OSC52_ENABLED,
}, },

View file

@ -247,6 +247,7 @@ struct config {
bool dpi_aware; bool dpi_aware;
bool gamma_correct; bool gamma_correct;
bool uppercase_regex_insert;
struct config_font_list fonts[4]; struct config_font_list fonts[4];
struct font_size_adjustment font_size_adjustment; struct font_size_adjustment font_size_adjustment;

View file

@ -231,6 +231,11 @@ empty string to be set, but it must be quoted: *KEY=""*)
Default: _no_. Default: _no_.
*upppercase-regex-insert*
Boolean. When enabled, inputting an uppercase hint character in
*show-urls-copy* or *regex-copy* mode will insert the selected
text into the prompt in addition to copying it to the clipboard.
*box-drawings-uses-font-glyphs* *box-drawings-uses-font-glyphs*
Boolean. When disabled, foot generates box/line drawing characters Boolean. When disabled, foot generates box/line drawing characters
itself. The are several advantages to doing this instead of using itself. The are several advantages to doing this instead of using

View file

@ -40,6 +40,8 @@
# utmp-helper=/usr/lib/utempter/utempter # When utmp backend is libutempter (Linux) # utmp-helper=/usr/lib/utempter/utempter # When utmp backend is libutempter (Linux)
# utmp-helper=/usr/libexec/ulog-helper # When utmp backend is ulog (FreeBSD) # utmp-helper=/usr/libexec/ulog-helper # When utmp backend is ulog (FreeBSD)
# uppercase-regex-insert=no
[environment] [environment]
# name=value # name=value

View file

@ -283,7 +283,8 @@ urls_input(struct seat *seat, struct terminal *term,
if (match) { if (match) {
// If the last hint character was uppercase, copy and paste // If the last hint character was uppercase, copy and paste
activate_url(seat, term, match, serial, wc == toc32upper(wc)); bool insert = term->conf->uppercase_regex_insert && wc == toc32upper(wc);
activate_url(seat, term, match, serial, insert);
switch (match->action) { switch (match->action) {
case URL_ACTION_COPY: case URL_ACTION_COPY: