Commit: 67a4036d64af17d85971d3e9f3f32f130db5c73c
Parent: 5891ce7bae709d3026df0a9f89c57798e1dd8478
Author: Randy Palamar
Date: Fri, 5 Jul 2024 21:51:52 -0600
inverse and dim text
Diffstat:
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/terminal.c b/terminal.c
@@ -305,8 +305,18 @@ handle_escape(Term *t, s8 *raw)
case '%': /* utf-8 mode */
get_ascii(raw);
break;
+ case '=': /* DECPAM -- application keypad */
+ case '>': /* DECPNM -- normal keypad mode */
+ /* TODO: MODE_APPKEYPAD */
+ break;
+ case 'M': /* RI -- Reverse Index */
+ /* TODO: if the cursor is currently at the top of the terminal this
+ * needs to shift everything down by one row. Otherwise this just
+ * shifts the moves the cursor up one row */
+ asm("nop");
+ break;
default:
- //fprintf(stderr, "unknown escape sequence: ESC %c (0x%02x)\n", cp, cp);
+ fprintf(stderr, "unknown escape sequence: ESC %c (0x%02x)\n", cp, cp);
break;
}
return result;
diff --git a/vtgl.c b/vtgl.c
@@ -184,7 +184,7 @@ draw_rectangle(GLCtx *gl, Rect r, Colour colour)
}
static void
-push_cell(Term *t, u32 cp, Rect r, u32 bg, u32 fg)
+push_cell(Term *t, u32 cp, Rect r, Colour bg, Colour fg)
{
GLCtx *gl = &t->gl;
Glyph g;
@@ -213,11 +213,16 @@ push_cell(Term *t, u32 cp, Rect r, u32 bg, u32 fg)
vertscale[1] = (v2){.x = g.size.w, .y = g.size.h};
vertoff[1] = texture_position;
+ u32 attr = t->cursor.state.attr;
+
+ if (attr & ATTR_FAINT)
+ fg.a = 0.5 * 255;
+
u32 colours[4];
- colours[0] = fg;
- colours[1] = bg;
- colours[2] = fg;
- colours[3] = bg;
+ colours[0] = (attr & ATTR_INVERSE)? bg.rgba : fg.rgba;
+ colours[1] = (attr & ATTR_INVERSE)? fg.rgba : bg.rgba;
+ colours[2] = (attr & ATTR_INVERSE)? bg.rgba : fg.rgba;
+ colours[3] = (attr & ATTR_INVERSE)? fg.rgba : bg.rgba;
glUniform2uiv(gl->render.texcolour, 2, colours);
glUniform1iv(gl->render.charmap, 2, charmap);
@@ -270,7 +275,7 @@ push_line(Term *t, Line *line, v2 start_pos)
CLAMP(cp, ' ', '~');
cr.pos.w = cs.w * t->cursor.col;
cr.pos.h = t->gl.window_size.h - (t->cursor.row + 1) * cs.h;
- push_cell(t, cp, cr, t->cursor.state.bg.rgba, t->cursor.state.fg.rgba);
+ push_cell(t, cp, cr, t->cursor.state.bg, t->cursor.state.fg);
/* TODO: properly advance cursor */
cursor_step_column(t, 1);
}