summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/term.c b/term.c
index a557725..5814f33 100644
--- a/term.c
+++ b/term.c
@@ -54,6 +54,7 @@ static void move(struct Cell *dst, struct Cell *src, uint len) {
 }
 
 static void scrollUp(struct Term *term, uint top, uint n) {
+	if (!n) return;
 	move(
 		cell(term, top, 0),
 		cell(term, top + n, 0),
@@ -67,6 +68,7 @@ static void scrollUp(struct Term *term, uint top, uint n) {
 }
 
 static void scrollDown(struct Term *term, uint top, uint n) {
+	if (!n) return;
 	move(
 		cell(term, top + n, 0),
 		cell(term, top, 0),
@@ -177,12 +179,12 @@ ACTION(ech) {
 }
 
 ACTION(dch) {
-	uint n = MIN(P(0, 1), t->cols - X);
+	uint n = MIN(P(0, 1), t->cols - X); if (!n) return;
 	move(C(Y, X), C(Y, X + n), t->cols - X - n);
 	erase(t->style, C(Y, t->cols - n), C(Y, R));
 }
 ACTION(ich) {
-	uint n = MIN(P(0, 1), t->cols - X);
+	uint n = MIN(P(0, 1), t->cols - X); if (!n) return;
 	move(C(Y, X + n), C(Y, X), t->cols - X - n);
 	erase(t->style, C(Y, X), C(Y, X + n - 1));
 }