diff options
author | June McEnroe <june@causal.agency> | 2019-08-13 00:30:49 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-08-13 00:30:49 -0400 |
commit | 16281106ebd66b98741d298df90b8fe1be360dbc (patch) | |
tree | feb5a242901ca908827aaa44059066d6a0aa74a7 | |
parent | Set up afl-fuzz (diff) | |
download | stream-16281106ebd66b98741d298df90b8fe1be360dbc.tar.gz stream-16281106ebd66b98741d298df90b8fe1be360dbc.zip |
Avoid inserting or deleting 0
Diffstat (limited to '')
-rw-r--r-- | term.c | 6 |
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)); } |