config: add 'uppercase-regex-insert'

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 "on", preserving the new behavior of `foot`, after

Fixes #2159.
This commit is contained in:
Ryan Roden-Corrent 2025-08-07 08:18:38 -04:00 committed by Daniel Eklöf
parent f0e36e35cb
commit 298196365c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 24 additions and 1 deletions

View file

@ -67,6 +67,13 @@
## Unreleased
### 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. It defaults to `true`. ([#2159][2159]).
[2159]: https://codeberg.org/dnkl/foot/issues/2159
### Changed
* The label letters are no longer sorted before being assigned to URLs

View file

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

View file

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

View file

@ -231,6 +231,13 @@ empty string to be set, but it must be quoted: *KEY=""*)
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.
Default: _yes_
*box-drawings-uses-font-glyphs*
Boolean. When disabled, foot generates box/line drawing characters
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/libexec/ulog-helper # When utmp backend is ulog (FreeBSD)
# uppercase-regex-insert=yes
[environment]
# name=value

View file

@ -491,6 +491,7 @@ test_section_main(void)
test_boolean(&ctx, &parse_section_main, "locked-title", &conf.locked_title);
test_boolean(&ctx, &parse_section_main, "dpi-aware", &conf.dpi_aware);
test_boolean(&ctx, &parse_section_main, "gamma-correct-blending", &conf.gamma_correct);
test_boolean(&ctx, &parse_section_main, "uppercase-regex-insert", &conf.uppercase_regex_insert);
test_pt_or_px(&ctx, &parse_section_main, "font-size-adjustment", &conf.font_size_adjustment.pt_or_px); /* TODO: test N% values too */
test_pt_or_px(&ctx, &parse_section_main, "line-height", &conf.line_height);

View file

@ -283,7 +283,8 @@ urls_input(struct seat *seat, struct terminal *term,
if (match) {
// 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) {
case URL_ACTION_COPY: