aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-14 09:26:14 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-14 09:26:14 +0000
commit6ea9d1246f5aaa02b8706b67c90776787dccbd68 (patch)
tree98391b632c36c35d633edb134cda64c05c4a9650
parentterm: line-wrap: manually set cursor row+col (diff)
term: print: also require width > 1 when checking if we need to force-wrap or not
While this might seem like it would slow down things, it should in fact help the compiler optimize: the "normal" code path, that prints regular ASCII characters, always call term_print() with width == 1.
-rw-r--r--terminal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/terminal.c b/terminal.c
index 99ef16d7..7c1bb5cc 100644
--- a/terminal.c
+++ b/terminal.c
@@ -2392,7 +2392,9 @@ term_print(struct terminal *term, wchar_t wc, int width)
if (unlikely(width <= 0))
return;
- if (term->grid->cursor.point.col + width > term->cols) {
+ if (unlikely(width > 1) &&
+ term->grid->cursor.point.col + width > term->cols)
+ {
/* Multi-column character that doesn't fit on current line -
* force a line wrap */
term->grid->cursor.lcf = 1;