mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-02 07:15:31 -04:00
osc: add debug logs when colors are changed and reset
This commit is contained in:
parent
d8fb80ea32
commit
675504308a
1 changed files with 10 additions and 1 deletions
11
osc.c
11
osc.c
|
|
@ -307,6 +307,7 @@ osc_dispatch(struct terminal *term)
|
||||||
if (!parse_rgb(string, &color))
|
if (!parse_rgb(string, &color))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
LOG_DBG("change color definition for #%u to %06x", idx, color);
|
||||||
term->colors.table[idx] = color;
|
term->colors.table[idx] = color;
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
break;
|
break;
|
||||||
|
|
@ -340,6 +341,9 @@ osc_dispatch(struct terminal *term)
|
||||||
if (!parse_rgb(string, &color))
|
if (!parse_rgb(string, &color))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
LOG_DBG("change color definition for %s to %06x",
|
||||||
|
param == 10 ? "foreground" : "background", color);
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 10: term->colors.fg = color; break;
|
case 10: term->colors.fg = color; break;
|
||||||
case 11: term->colors.bg = color; break;
|
case 11: term->colors.bg = color; break;
|
||||||
|
|
@ -363,6 +367,7 @@ osc_dispatch(struct terminal *term)
|
||||||
/* Reset Color Number 'c' (whole table if no parameter) */
|
/* Reset Color Number 'c' (whole table if no parameter) */
|
||||||
|
|
||||||
if (strlen(string) == 0) {
|
if (strlen(string) == 0) {
|
||||||
|
LOG_DBG("resetting all colors");
|
||||||
for (size_t i = 0; i < 256; i++)
|
for (size_t i = 0; i < 256; i++)
|
||||||
term->colors.table[i] = term->colors.default_table[i];
|
term->colors.table[i] = term->colors.default_table[i];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -371,6 +376,7 @@ osc_dispatch(struct terminal *term)
|
||||||
for (; *string != '\0'; string++) {
|
for (; *string != '\0'; string++) {
|
||||||
char c = *string;
|
char c = *string;
|
||||||
if (c == ';') {
|
if (c == ';') {
|
||||||
|
LOG_DBG("resetting color #%u", idx);
|
||||||
term->colors.table[idx] = term->colors.default_table[idx];
|
term->colors.table[idx] = term->colors.default_table[idx];
|
||||||
idx = 0;
|
idx = 0;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -380,6 +386,7 @@ osc_dispatch(struct terminal *term)
|
||||||
idx += c - '0';
|
idx += c - '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_DBG("resetting color #%u", idx);
|
||||||
term->colors.table[idx] = term->colors.default_table[idx];
|
term->colors.table[idx] = term->colors.default_table[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,11 +398,13 @@ osc_dispatch(struct terminal *term)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 110: /* Reset default text foreground color */
|
case 110: /* Reset default text foreground color */
|
||||||
|
LOG_DBG("resetting foreground");
|
||||||
term->colors.fg = term->colors.default_fg;
|
term->colors.fg = term->colors.default_fg;
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 111: /* Reset default text backgroundc color */
|
case 111: /* Reset default text background color */
|
||||||
|
LOG_DBG("resetting background");
|
||||||
term->colors.bg = term->colors.default_bg;
|
term->colors.bg = term->colors.default_bg;
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue