From 703f73365b55911b51203315ea12aca69814408c Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 14 Aug 2019 15:07:39 -0400 Subject: Fix wrapping, maybe? It's enough for nvim to not be totally broken, anyway. --- term.c | 18 ++++++------------ 1 file 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 { -- cgit 1.4.1