vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: 911e62d70bd3674b0da791e5bb067ded5d5cfb1f
Parent: f26dd73ddd92d671d6f9a34e5480b6e06e8d318a
Author: Randy Palamar
Date:   Mon,  2 Sep 2024 08:32:59 -0600

support LNM (LF also enters CR)

Diffstat:
Mterminal.c | 14+++++++++-----
Mutil.h | 1+
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/terminal.c b/terminal.c @@ -413,6 +413,10 @@ set_mode(Term *t, CSI *csi, b32 set) if (set) t->mode |= TM_REPLACE; else t->mode &= ~TM_REPLACE; break; + case 20: /* LNM: Linefeed Assumes Carriage Return */ + if (set) t->mode |= TM_CRLF; + else t->mode &= ~TM_CRLF; + break; case PRIV(1): /* DECCKM: use application cursor keys */ if (set) t->gl.mode |= WIN_MODE_APPCURSOR; else t->gl.mode &= ~WIN_MODE_APPCURSOR; @@ -892,11 +896,11 @@ static void push_control(Term *t, s8 *line, u32 cp, Arena a) { switch (cp) { - case 0x1B: handle_escape(t, line, a); break; - case '\r': t->cursor.pos.x = 0; break; - case '\n': push_newline(t, 0); break; - case '\t': push_tab(t, 1); break; - case '\a': /* TODO: ding ding? */ break; + case 0x1B: handle_escape(t, line, a); break; + case '\r': t->cursor.pos.x = 0; break; + case '\n': push_newline(t, t->mode & TM_CRLF); break; + case '\t': push_tab(t, 1); break; + case '\a': /* TODO: ding ding? */ break; case '\b': cursor_move_to(t, t->cursor.pos.y, t->cursor.pos.x - 1); break; diff --git a/util.h b/util.h @@ -378,6 +378,7 @@ enum terminal_mode { TM_ALTSCREEN = 1 << 0, TM_REPLACE = 1 << 1, TM_AUTO_WRAP = 1 << 2, + TM_CRLF = 1 << 3, }; typedef struct {