Commit: 0fb0a5581dfe26f48d6959528c31d09042fbaf56
Parent: 34ce26e6a88de1f121d9e116f463d62f35663474
Author: Randy Palamar
Date: Fri, 25 Oct 2024 08:41:38 -0600
don't unnecessarily clear the fb when splitting lines
Diffstat:
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/terminal.c b/terminal.c
@@ -476,7 +476,7 @@ clear_term_tab(Term *t, i32 arg)
/* SM/DECSET: Set Mode & RM/DECRST Reset Mode */
static void
-set_mode(Term *t, CSI *csi, b32 set)
+set_mode(Term *t, CSI *csi, b32 set, b32 simulate)
{
BEGIN_TIMED_BLOCK();
i32 alt = t->view_idx;
@@ -530,7 +530,7 @@ set_mode(Term *t, CSI *csi, b32 set)
cursor_alt(t, set);
case PRIV(47): /* xterm: swap screen buffer */
case PRIV(1047): /* xterm: swap screen buffer */
- if (alt) fb_clear_region(t, 0, t->size.h, 0, t->size.w);
+ if (alt && !simulate) fb_clear_region(t, 0, t->size.h, 0, t->size.w);
if (set ^ alt) swap_screen(t);
if (csi->argv[i] != 1049) break;
/* FALLTHROUGH */
@@ -810,8 +810,8 @@ handle_csi(Term *t, CSI *csi)
case 'e': cursor_step_raw(t, ORONE(csi->argv[0]), 1, 0); break;
case 'f': cursor_move_abs_to(t, csi->argv[0] - 1, csi->argv[1] - 1); break;
case 'g': clear_term_tab(t, csi->argv[0]); break;
- case 'h': set_mode(t, csi, 1); break;
- case 'l': set_mode(t, csi, 0); break;
+ case 'h': set_mode(t, csi, 1, 0); break;
+ case 'l': set_mode(t, csi, 0, 0); break;
case 'm': set_colours(t, csi); break;
case 'r':
if (csi->priv)
@@ -1050,9 +1050,9 @@ check_if_csi_moves_cursor(Term *t, s8 *raw)
case 'd': result = EMC_CURSOR_MOVED; break;
case 'e': result = EMC_CURSOR_MOVED; break;
case 'f': result = EMC_CURSOR_MOVED; break;
- case 'h': set_mode(t, &csi, 1); break;
- case 'l': set_mode(t, &csi, 0); break;
- case 'm': set_colours(t, &csi); break;
+ case 'h': set_mode(t, &csi, 1, 1); break;
+ case 'l': set_mode(t, &csi, 0, 1); break;
+ case 'm': set_colours(t, &csi); break; /* NOTE: start of line needs right style */
default: break;
}
@@ -1096,13 +1096,10 @@ check_if_escape_moves_cursor(Term *t, s8 *raw)
result = EMC_CURSOR_MOVED;
break;
case 'M': /* RI -- Reverse Index */
- if (t->cursor.pos.y != 0)
- result = EMC_CURSOR_MOVED;
+ result = EMC_CURSOR_MOVED;
break;
- case '7': break;
case '8':
- if (!equal_iv2(t->cursor.pos, t->saved_cursors[t->view_idx].pos))
- result = EMC_CURSOR_MOVED;
+ result = EMC_CURSOR_MOVED;
break;
default: break;
}