summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);