From 68d795a0f9e21b43d51da0e36b6ee0bc3a637f13 Mon Sep 17 00:00:00 2001 From: ketmar Date: Thu, 10 May 2012 14:54:06 +0300 Subject: [PATCH] discard out-of-screen chars in 'wrap off' mode --- src/sterm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sterm.c b/src/sterm.c index 333d138..f8180a2 100644 --- a/src/sterm.c +++ b/src/sterm.c @@ -225,9 +225,9 @@ enum cursor_movement { }; enum cursor_state { - CURSOR_DEFAULT = 0, - CURSOR_HIDE = 1, - CURSOR_WRAPNEXT = 2 + CURSOR_DEFAULT = 0x00, + CURSOR_HIDE = 0x01, + CURSOR_WRAPNEXT = 0x02 }; enum glyph_state { @@ -3251,7 +3251,10 @@ static void tputc (const char *c) { } else { if ((unsigned char)ascii < 32 || ascii == 127) break; // seems that this chars are empty too } - if (IS_SET(MODE_WRAP) && (term->c.state&CURSOR_WRAPNEXT)) tnewline(1); // always go to first col + if (term->c.state&CURSOR_WRAPNEXT) { + if (IS_SET(MODE_WRAP)) tnewline(1); // always go to first col + else break; // wrap is off, don't want more chars + } tsetchar(c); if (term->c.x+1 < term->col) tmoveto(term->c.x+1, term->c.y); else term->c.state |= CURSOR_WRAPNEXT; } while (0); -- 2.11.4.GIT