summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-08-14 16:00:12 -0400
committerJune McEnroe <june@causal.agency>2019-08-14 16:00:12 -0400
commit0efc0610f3c34fbe7d5a66a2bcb3220bada08a47 (patch)
tree44fce6d3c545df52e18f7481577f95650cb068a2
parentFix wrapping, maybe? (diff)
downloadstream-0efc0610f3c34fbe7d5a66a2bcb3220bada08a47.tar.gz
stream-0efc0610f3c34fbe7d5a66a2bcb3220bada08a47.zip
Behave like ICH in IRM
This should fix another OOB bug.
-rw-r--r--term.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/term.c b/term.c
index 178e613..a7e53bf 100644
--- a/term.c
+++ b/term.c
@@ -328,7 +328,8 @@ ACTION(add) {
 	}
 
 	if (t->mode & Insert) {
-		move(C(Y, X + width), C(Y, X), t->cols - X - width);
+		uint n = MIN((uint)width, t->cols - X);
+		move(C(Y, X + n), C(Y, X), t->cols - X - n);
 	}
 	if (t->mode & Wrap && X + width > t->cols) {
 		cr(t, ch);