diff options
Diffstat (limited to '')
-rw-r--r-- | term.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/term.c b/term.c index 418fdf6..178e613 100644 --- a/term.c +++ b/term.c @@ -326,28 +326,22 @@ ACTION(add) { unhandled("\\u%02X", ch); return; } - if (X + width > t->cols) { - unhandled("'%lc' too wide", ch); - return; - } if (t->mode & Insert) { move(C(Y, X + width), C(Y, X), t->cols - X - width); } + if (t->mode & Wrap && X + width > t->cols) { + cr(t, ch); + nl(t, ch); + } C(Y, X)->style = t->style; C(Y, X)->ch = ch; - for (int i = 1; i < width; ++i) { + for (int i = 1; i < width && X + i < t->cols; ++i) { C(Y, X + i)->style = t->style; C(Y, X + i)->ch = L'\0'; } - - if (t->mode & Wrap && X + width >= t->cols) { - cr(t, 0); - nl(t, 0); - } else { - X = MIN(X + width, R); - } + X = MIN(X + width, (t->mode & Wrap ? t->cols : R)); } enum { |