Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
saeedark 2025-09-17 14:10:19 +03:30
commit 6fd357a46e
10 changed files with 65 additions and 16 deletions

View file

@ -1,6 +1,7 @@
# Changelog # Changelog
* [Unreleased](#unreleased) * [Unreleased](#unreleased)
* [1.24.0](#1-24-0)
* [1.23.1](#1-23-1) * [1.23.1](#1-23-1)
* [1.23.0](#1-23-0) * [1.23.0](#1-23-0)
* [1.22.3](#1-22-3) * [1.22.3](#1-22-3)
@ -67,10 +68,28 @@
## Unreleased ## Unreleased
### Added ### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
### Contributors
## 1.24.0
### 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 ### 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
([#2140]2140[]). ([#2140][2140]).
* Sending SIGUSR1/SIGUSR2 to a `foot --server` process now causes * Sending SIGUSR1/SIGUSR2 to a `foot --server` process now causes
newly spawned client instances to use the selected theme, instead of newly spawned client instances to use the selected theme, instead of
the original one. the original one.
@ -80,12 +99,18 @@
[2156]: https://codeberg.org/dnkl/foot/issues/2156 [2156]: https://codeberg.org/dnkl/foot/issues/2156
### Deprecated
### Removed
### Fixed ### Fixed
### Security
* Invalid configuration values overriding valid ones in surprising
ways.
* Bug where the libutempter utmp backend did not record logouts
correctly.
### Contributors ### Contributors
* Ryan Roden-Corrent
* Tobias Mock
## 1.23.1 ## 1.23.1

View file

@ -483,8 +483,12 @@ str_to_ulong(const char *s, int base, unsigned long *res)
errno = 0; errno = 0;
char *end = NULL; char *end = NULL;
*res = strtoul(s, &end, base); unsigned long v = strtoul(s, &end, base);
return errno == 0 && *end == '\0'; if (!(errno == 0 && *end == '\0'))
return false;
*res = v;
return true;
} }
static bool NOINLINE static bool NOINLINE
@ -553,12 +557,13 @@ value_to_float(struct context *ctx, float *res)
errno = 0; errno = 0;
char *end = NULL; char *end = NULL;
*res = strtof(s, &end); float v = strtof(s, &end);
if (!(errno == 0 && *end == '\0')) { if (!(errno == 0 && *end == '\0')) {
LOG_CONTEXTUAL_ERR("invalid decimal value"); LOG_CONTEXTUAL_ERR("invalid decimal value");
return false; return false;
} }
*res = v;
return true; return true;
} }
@ -650,7 +655,6 @@ value_to_enum(struct context *ctx, const char **value_map, int *res)
valid_values[idx - 2] = '\0'; valid_values[idx - 2] = '\0';
LOG_CONTEXTUAL_ERR("not one of %s", valid_values); LOG_CONTEXTUAL_ERR("not one of %s", valid_values);
*res = -1;
return false; return false;
} }
@ -699,14 +703,18 @@ value_to_two_colors(struct context *ctx,
goto out; goto out;
} }
uint32_t a, b;
ctx->value = first_as_str; ctx->value = first_as_str;
if (!value_to_color(ctx, first, allow_alpha)) if (!value_to_color(ctx, &a, allow_alpha))
goto out; goto out;
ctx->value = second_as_str; ctx->value = second_as_str;
if (!value_to_color(ctx, second, allow_alpha)) if (!value_to_color(ctx, &b, allow_alpha))
goto out; goto out;
*first = a;
*second = b;
ret = true; ret = true;
out: out:
@ -1134,6 +1142,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;
@ -3453,6 +3464,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 = true,
.security = { .security = {
.osc52 = OSC52_ENABLED, .osc52 = OSC52_ENABLED,
}, },

View file

@ -261,6 +261,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,13 @@ empty string to be set, but it must be quoted: *KEY=""*)
Default: _no_. Default: _no_.
*uppercase-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* *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=yes
[environment] [environment]
# name=value # name=value

View file

@ -1889,7 +1889,7 @@ keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
UNITTEST UNITTEST
{ {
int chan[2]; int chan[2];
pipe2(chan, O_CLOEXEC); xassert(pipe2(chan, O_CLOEXEC) == 0);
xassert(chan[0] >= 0); xassert(chan[0] >= 0);
xassert(chan[1] >= 0); xassert(chan[1] >= 0);

View file

@ -1,5 +1,5 @@
project('foot', 'c', project('foot', 'c',
version: '1.23.1', version: '1.24.0',
license: 'MIT', license: 'MIT',
meson_version: '>=0.59.0', meson_version: '>=0.59.0',
default_options: [ default_options: [
@ -53,7 +53,7 @@ if utmp_backend == 'none'
elif utmp_backend == 'libutempter' elif utmp_backend == 'libutempter'
utmp_add = 'add' utmp_add = 'add'
utmp_del = 'del' utmp_del = 'del'
utmp_del_have_argument = true utmp_del_have_argument = false
if utmp_default_helper_path == 'auto' if utmp_default_helper_path == 'auto'
utmp_default_helper_path = join_paths('/usr', get_option('libdir'), 'utempter', 'utempter') utmp_default_helper_path = join_paths('/usr', get_option('libdir'), 'utempter', 'utempter')
endif endif

View file

@ -199,7 +199,7 @@ add_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
return true; return true;
char *const argv[] = {conf->utmp_helper_path, UTMP_ADD, getenv("WAYLAND_DISPLAY"), NULL}; char *const argv[] = {conf->utmp_helper_path, UTMP_ADD, getenv("WAYLAND_DISPLAY"), NULL};
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL, NULL, NULL) >= 0; return spawn(reaper, NULL, argv, ptmx, -1, -1, NULL, NULL, NULL) >= 0;
#else #else
return true; return true;
#endif #endif
@ -223,7 +223,7 @@ del_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
; ;
char *const argv[] = {conf->utmp_helper_path, UTMP_DEL, del_argument, NULL}; char *const argv[] = {conf->utmp_helper_path, UTMP_DEL, del_argument, NULL};
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL, NULL, NULL) >= 0; return spawn(reaper, NULL, argv, ptmx, -1, -1, NULL, NULL, NULL) >= 0;
#else #else
return true; return true;
#endif #endif

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, "locked-title", &conf.locked_title);
test_boolean(&ctx, &parse_section_main, "dpi-aware", &conf.dpi_aware); 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, "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, "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); 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 (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: