mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
parent
4873004c37
commit
d79a3b9350
7 changed files with 85 additions and 7 deletions
|
|
@ -50,10 +50,13 @@
|
||||||
* Support for jumping to previous/next prompt (requires shell
|
* Support for jumping to previous/next prompt (requires shell
|
||||||
integration). By default bound to `ctrl`+`shift`+`z` and
|
integration). By default bound to `ctrl`+`shift`+`z` and
|
||||||
`ctrl`+`shift`+`x` respectively ([#30][30]).
|
`ctrl`+`shift`+`x` respectively ([#30][30]).
|
||||||
|
* `colors.search-box-no-match` and `colors.search-box-match` options
|
||||||
|
to `foot.ini` ([#1112][1112]).
|
||||||
|
|
||||||
[1058]: https://codeberg.org/dnkl/foot/issues/1058
|
[1058]: https://codeberg.org/dnkl/foot/issues/1058
|
||||||
[1070]: https://codeberg.org/dnkl/foot/issues/1070
|
[1070]: https://codeberg.org/dnkl/foot/issues/1070
|
||||||
[30]: https://codeberg.org/dnkl/foot/issues/30
|
[30]: https://codeberg.org/dnkl/foot/issues/30
|
||||||
|
[1112]: https://codeberg.org/dnkl/foot/issues/1112
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
28
config.c
28
config.c
|
|
@ -1171,6 +1171,34 @@ parse_section_colors(struct context *ctx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "search-box-no-match") == 0) {
|
||||||
|
if (!value_to_two_colors(
|
||||||
|
ctx,
|
||||||
|
&conf->colors.search_box.no_match.fg,
|
||||||
|
&conf->colors.search_box.no_match.bg,
|
||||||
|
false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf->colors.use_custom.search_box_no_match = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "search-box-match") == 0) {
|
||||||
|
if (!value_to_two_colors(
|
||||||
|
ctx,
|
||||||
|
&conf->colors.search_box.match.fg,
|
||||||
|
&conf->colors.search_box.match.bg,
|
||||||
|
false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf->colors.use_custom.search_box_match = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "urls") == 0) {
|
else if (strcmp(key, "urls") == 0) {
|
||||||
if (!value_to_color(ctx, &conf->colors.url, false))
|
if (!value_to_color(ctx, &conf->colors.url, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
14
config.h
14
config.h
|
|
@ -217,11 +217,25 @@ struct config {
|
||||||
uint32_t bg;
|
uint32_t bg;
|
||||||
} scrollback_indicator;
|
} scrollback_indicator;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct {
|
||||||
|
uint32_t fg;
|
||||||
|
uint32_t bg;
|
||||||
|
} no_match;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
uint32_t fg;
|
||||||
|
uint32_t bg;
|
||||||
|
} match;
|
||||||
|
} search_box;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool selection:1;
|
bool selection:1;
|
||||||
bool jump_label:1;
|
bool jump_label:1;
|
||||||
bool scrollback_indicator:1;
|
bool scrollback_indicator:1;
|
||||||
bool url:1;
|
bool url:1;
|
||||||
|
bool search_box_no_match:1;
|
||||||
|
bool search_box_match:1;
|
||||||
uint8_t dim;
|
uint8_t dim;
|
||||||
} use_custom;
|
} use_custom;
|
||||||
} colors;
|
} colors;
|
||||||
|
|
|
||||||
|
|
@ -566,6 +566,16 @@ can configure the background transparency with the _alpha_ option.
|
||||||
(indicator itself) colors for the scrollback indicator. Default:
|
(indicator itself) colors for the scrollback indicator. Default:
|
||||||
_regular0 bright4_.
|
_regular0 bright4_.
|
||||||
|
|
||||||
|
*search-box-no-match*
|
||||||
|
Two color values specifying the foreground (text) and background
|
||||||
|
colors for the scrollback search box, when there are no
|
||||||
|
matches. Default: _regular0 regular1_.
|
||||||
|
|
||||||
|
*search-box-match*
|
||||||
|
Two color values specifying the foreground (text) and background
|
||||||
|
colors for the scrollback search box, when the search box is
|
||||||
|
either empty, or there are matches. Default: _regular0 regular3_.
|
||||||
|
|
||||||
*urls*
|
*urls*
|
||||||
Color to use for the underline used to highlight URLs in URL
|
Color to use for the underline used to highlight URLs in URL
|
||||||
mode. Default: _regular3_.
|
mode. Default: _regular3_.
|
||||||
|
|
|
||||||
6
foot.ini
6
foot.ini
|
|
@ -104,9 +104,11 @@
|
||||||
## Misc colors
|
## Misc colors
|
||||||
# selection-foreground=<inverse foreground/background>
|
# selection-foreground=<inverse foreground/background>
|
||||||
# selection-background=<inverse foreground/background>
|
# selection-background=<inverse foreground/background>
|
||||||
# jump-labels=<regular0> <regular3>
|
# jump-labels=<regular0> <regular3> # black-on-yellow
|
||||||
|
# scrollback-indicator=<regular0> <bright4> # black-on-bright-blue
|
||||||
|
# search-box-no-match=<regular0> <regular1> # black-on-red
|
||||||
|
# search-box-match=<regular0> <regular3> # black-on-yellow
|
||||||
# urls=<regular3>
|
# urls=<regular3>
|
||||||
# scrollback-indicator=<regular0> <bright4>
|
|
||||||
|
|
||||||
[csd]
|
[csd]
|
||||||
# preferred=server
|
# preferred=server
|
||||||
|
|
|
||||||
25
render.c
25
render.c
|
|
@ -3046,10 +3046,20 @@ render_search_box(struct terminal *term)
|
||||||
#define WINDOW_X(x) (margin + x)
|
#define WINDOW_X(x) (margin + x)
|
||||||
#define WINDOW_Y(y) (term->height - margin - height + y)
|
#define WINDOW_Y(y) (term->height - margin - height + y)
|
||||||
|
|
||||||
/* Background - yellow on empty/match, red on mismatch */
|
const bool is_match = term->search.match_len == text_len;
|
||||||
pixman_color_t color = color_hex_to_pixman(
|
const bool custom_colors = is_match
|
||||||
term->search.match_len == text_len
|
? term->conf->colors.use_custom.search_box_match
|
||||||
? term->colors.table[3] : term->colors.table[1]);
|
: term->conf->colors.use_custom.search_box_no_match;
|
||||||
|
|
||||||
|
/* Background - yellow on empty/match, red on mismatch (default) */
|
||||||
|
const pixman_color_t color = color_hex_to_pixman(
|
||||||
|
is_match
|
||||||
|
? (custom_colors
|
||||||
|
? term->conf->colors.search_box.match.bg
|
||||||
|
: term->colors.table[3])
|
||||||
|
: (custom_colors
|
||||||
|
? term->conf->colors.search_box.no_match.bg
|
||||||
|
: term->colors.table[1]));
|
||||||
|
|
||||||
pixman_image_fill_rectangles(
|
pixman_image_fill_rectangles(
|
||||||
PIXMAN_OP_SRC, buf->pix[0], &color,
|
PIXMAN_OP_SRC, buf->pix[0], &color,
|
||||||
|
|
@ -3065,7 +3075,12 @@ render_search_box(struct terminal *term)
|
||||||
const int x_ofs = term->font_x_ofs;
|
const int x_ofs = term->font_x_ofs;
|
||||||
int x = x_left;
|
int x = x_left;
|
||||||
int y = margin;
|
int y = margin;
|
||||||
pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]);
|
pixman_color_t fg = color_hex_to_pixman(
|
||||||
|
custom_colors
|
||||||
|
? (is_match
|
||||||
|
? term->conf->colors.search_box.match.fg
|
||||||
|
: term->conf->colors.search_box.no_match.fg)
|
||||||
|
: term->colors.table[0]);
|
||||||
|
|
||||||
/* Move offset we start rendering at, to ensure the cursor is visible */
|
/* Move offset we start rendering at, to ensure the cursor is visible */
|
||||||
for (size_t i = 0, cell_idx = 0; i <= term->search.cursor; cell_idx += widths[i], i++) {
|
for (size_t i = 0, cell_idx = 0; i <= term->search.cursor; cell_idx += widths[i], i++) {
|
||||||
|
|
|
||||||
|
|
@ -668,6 +668,12 @@ test_section_colors(void)
|
||||||
test_two_colors(&ctx, &parse_section_colors, "scrollback-indicator", false,
|
test_two_colors(&ctx, &parse_section_colors, "scrollback-indicator", false,
|
||||||
&conf.colors.scrollback_indicator.fg,
|
&conf.colors.scrollback_indicator.fg,
|
||||||
&conf.colors.scrollback_indicator.bg);
|
&conf.colors.scrollback_indicator.bg);
|
||||||
|
test_two_colors(&ctx, &parse_section_colors, "search-box-no-match", false,
|
||||||
|
&conf.colors.search_box.no_match.fg,
|
||||||
|
&conf.colors.search_box.no_match.bg);
|
||||||
|
test_two_colors(&ctx, &parse_section_colors, "search-box-match", false,
|
||||||
|
&conf.colors.search_box.match.fg,
|
||||||
|
&conf.colors.search_box.match.bg);
|
||||||
|
|
||||||
for (size_t i = 0; i < 255; i++) {
|
for (size_t i = 0; i < 255; i++) {
|
||||||
char key_name[4];
|
char key_name[4];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue