mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-16 22:05:21 -05:00
osc 104: handle multiple indices the same way we do in OSC 4 - use strtok()
This commit is contained in:
parent
ae1b235eaa
commit
5b67e97fc2
1 changed files with 13 additions and 14 deletions
27
osc.c
27
osc.c
|
|
@ -559,24 +559,23 @@ osc_dispatch(struct terminal *term)
|
||||||
LOG_DBG("resetting all colors");
|
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 {
|
}
|
||||||
unsigned idx = 0;
|
|
||||||
|
|
||||||
for (; *string != '\0'; string++) {
|
else {
|
||||||
char c = *string;
|
for (const char *s_idx = strtok(string, ";");
|
||||||
if (c == ';') {
|
s_idx != NULL;
|
||||||
LOG_DBG("resetting color #%u", idx);
|
s_idx = strtok(NULL, ";"))
|
||||||
term->colors.table[idx] = term->colors.default_table[idx];
|
{
|
||||||
idx = 0;
|
unsigned idx = 0;
|
||||||
continue;
|
for (; *s_idx != '\0'; s_idx++) {
|
||||||
|
char c = *s_idx;
|
||||||
|
idx *= 10;
|
||||||
|
idx += c - '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
idx *= 10;
|
LOG_DBG("resetting color #%u", idx);
|
||||||
idx += c - '0';
|
term->colors.table[idx] = term->colors.default_table[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("resetting color #%u", idx);
|
|
||||||
term->colors.table[idx] = term->colors.default_table[idx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue