vtgl

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

Commit: 4c203e3c776786e5b643f65849b1321c29259ba9
Parent: f46fdce43af7076fd42711e2ce42bb4f03fb188e
Author: Randy Palamar
Date:   Tue, 20 Aug 2024 23:16:52 -0600

csi: add a handful of cursor movement commands

Diffstat:
Mterminal.c | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/terminal.c b/terminal.c @@ -548,12 +548,25 @@ handle_csi(Term *t, s8 *raw) CSI csi = parse_csi(raw); ASSERT(csi.argc != -1); + #define ORONE(x) (x)? (x) : 1 + + iv2 p = t->cursor.pos; + u8 next; switch (csi.mode) { - case 'G': cursor_move_to(t, t->cursor.pos.y, csi.argv[0] - 1); break; + case 'A': cursor_move_to(t, p.y - ORONE(csi.argv[0]), p.x); break; + case 'B': cursor_move_to(t, p.y + ORONE(csi.argv[0]), p.x); break; + case 'C': cursor_move_to(t, p.y, p.x + ORONE(csi.argv[0])); break; + case 'D': cursor_move_to(t, p.y, p.x - ORONE(csi.argv[0])); break; + case 'E': cursor_move_to(t, p.y + ORONE(csi.argv[0]), 0); break; + case 'F': cursor_move_to(t, p.y - ORONE(csi.argv[0]), 0); break; + case 'G': cursor_move_to(t, p.y, csi.argv[0] - 1); break; case 'H': cursor_move_to(t, csi.argv[0] - 1, csi.argv[1] - 1); break; case 'J': erase_in_display(t, &csi); break; case 'K': erase_in_line(t, &csi); break; + case 'a': cursor_move_to(t, p.y, p.x + ORONE(csi.argv[0])); break; + case 'd': cursor_move_to(t, csi.argv[0] - 1, p.x); break; + case 'e': cursor_move_to(t, p.y + ORONE(csi.argv[0]), p.x); break; case 'h': set_mode(t, &csi, 1); break; case 'l': set_mode(t, &csi, 0); break; case 'm': set_colours(t, &csi); break;