mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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:
parent
f0e36e35cb
commit
298196365c
7 changed files with 24 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
4
config.c
4
config.c
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
1
config.h
1
config.h
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
2
foot.ini
2
foot.ini
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue