From 16281106ebd66b98741d298df90b8fe1be360dbc Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 13 Aug 2019 00:30:49 -0400 Subject: Avoid inserting or deleting 0 --- term.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'term.c') 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)); } -- cgit 1.4.1