mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-25 06:46:36 -04:00
csi: sgr: treat CSI[m as CSI[0m (SGR reset)
This commit is contained in:
parent
4b6ea810fc
commit
9c9ad48745
1 changed files with 21 additions and 10 deletions
31
csi.c
31
csi.c
|
|
@ -16,22 +16,33 @@
|
||||||
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
|
|
||||||
|
static void
|
||||||
|
sgr_reset(struct terminal *term)
|
||||||
|
{
|
||||||
|
term->vt.attrs.bold = false;
|
||||||
|
term->vt.dim = false;
|
||||||
|
term->vt.attrs.italic = false;
|
||||||
|
term->vt.attrs.underline = false;
|
||||||
|
term->vt.attrs.strikethrough = false;
|
||||||
|
term->vt.attrs.blink = false;
|
||||||
|
term->vt.attrs.conceal = false;
|
||||||
|
term->vt.attrs.reverse = false;
|
||||||
|
term->vt.attrs.foreground = term->grid.foreground;
|
||||||
|
term->vt.attrs.background = term->grid.background;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
csi_sgr(struct terminal *term)
|
csi_sgr(struct terminal *term)
|
||||||
{
|
{
|
||||||
|
if (term->vt.params.idx == 0) {
|
||||||
|
sgr_reset(term);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < term->vt.params.idx; i++) {
|
for (size_t i = 0; i < term->vt.params.idx; i++) {
|
||||||
switch (term->vt.params.v[i].value) {
|
switch (term->vt.params.v[i].value) {
|
||||||
case 0:
|
case 0:
|
||||||
term->vt.attrs.bold = false;
|
sgr_reset(term);
|
||||||
term->vt.dim = false;
|
|
||||||
term->vt.attrs.italic = false;
|
|
||||||
term->vt.attrs.underline = false;
|
|
||||||
term->vt.attrs.strikethrough = false;
|
|
||||||
term->vt.attrs.blink = false;
|
|
||||||
term->vt.attrs.conceal = false;
|
|
||||||
term->vt.attrs.reverse = false;
|
|
||||||
term->vt.attrs.foreground = term->grid.foreground;
|
|
||||||
term->vt.attrs.background = term->grid.background;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: term->vt.attrs.bold = true; break;
|
case 1: term->vt.attrs.bold = true; break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue