Commit: 88fa76c0a0be7e7056eff429e521f83a3df2bfc2
Parent: 3bd4216b2947d88e371c6b5de1ecb2fff44379af
Author: Randy Palamar
Date: Thu, 22 Aug 2024 19:59:25 -0600
NEL (ESC E) - next line
Diffstat:
M | terminal.c | | | 43 | +++++++++++++++++++++++++------------------ |
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/terminal.c b/terminal.c
@@ -494,6 +494,24 @@ window_manipulation(Term *t, CSI *csi)
}
}
+static void
+push_newline(Term *t)
+{
+ t->cursor.pos.y++;
+ if (t->cursor.pos.y == t->size.h) {
+ t->cursor.pos.y = t->size.h - 1;
+ fb_scroll_up(t, 0, 1);
+ }
+}
+
+static void
+push_tab(Term *t)
+{
+ u32 advance = g_tabstop - (t->cursor.pos.x % g_tabstop);
+ fb_clear_region(t, t->cursor.pos.y, t->cursor.pos.y, t->cursor.pos.x, t->cursor.pos.x + advance);
+ cursor_step_column(t, advance);
+}
+
static CSI
parse_csi(s8 *r)
{
@@ -677,6 +695,10 @@ handle_escape(Term *t, s8 *raw, Arena a)
case 'c': /* RIS -- Reset to Initial State */
term_reset(t);
break;
+ case 'E': /* NEL - Next Line */
+ t->cursor.pos.x = 0;
+ push_newline(t);
+ break;
case 'M': /* RI -- Reverse Index */
if (t->cursor.pos.y == 0) {
fb_scroll_down(t, 0, 1);
@@ -755,6 +777,9 @@ check_if_escape_moves_cursor(Term *t, s8 *raw)
case 'c': /* RIS -- Reset to Initial State */
result = EMC_CURSOR_MOVED;
break;
+ case 'E': /* NEL - Next Line */
+ result = EMC_CURSOR_MOVED;
+ break;
case 'M': /* RI -- Reverse Index */
if (t->cursor.pos.y != 0)
result = EMC_CURSOR_MOVED;
@@ -860,24 +885,6 @@ split_raw_input_to_lines(Term *t, s8 raw)
}
static void
-push_newline(Term *t)
-{
- t->cursor.pos.y++;
- if (t->cursor.pos.y == t->size.h) {
- t->cursor.pos.y = t->size.h - 1;
- fb_scroll_up(t, 0, 1);
- }
-}
-
-static void
-push_tab(Term *t)
-{
- u32 advance = g_tabstop - (t->cursor.pos.x % g_tabstop);
- fb_clear_region(t, t->cursor.pos.y, t->cursor.pos.y, t->cursor.pos.x, t->cursor.pos.x + advance);
- cursor_step_column(t, advance);
-}
-
-static void
push_line(Term *t, Line *line, Arena a)
{
TermView *tv = t->views + t->view_idx;