vtgl

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

Commit: ff7eb7ae337b13b9bd1a3a3dd803d64cc85d557a
Parent: c59f7f3220bce900dc34675b20d20dc022c7b193
Author: Randy Palamar
Date:   Fri,  8 Nov 2024 12:27:29 -0700

fix two cursor movement bugs shown by pacman

first: '\r' when the cursor is past the end of the line needs to
clear WRAP_NEXT since we don't need to wrap if we have already
moved to the start of the line.

second: ORONE() macro needs to be wrapped in parentheses so that
the c order of operations doesn't break our check by computing the
math on the left side first.

Diffstat:
Mterminal.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/terminal.c b/terminal.c @@ -842,7 +842,7 @@ handle_csi(Term *t, CSI *csi) i32 ret = parse_csi(&raw, csi); ASSERT(ret != -1); - #define ORONE(x) (x)? (x) : 1 + #define ORONE(x) ((x)? (x) : 1) iv2 p = t->cursor.pos; @@ -1077,10 +1077,10 @@ push_control(Term *t, s8 *line, u32 cp, Arena a) if (!line->len) result = 1; else result = 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 '\r': cursor_move_to(t, t->cursor.pos.y, 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;