From a3e67d856797274f3d06e6c7b93fb7b72b1dafeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksandar=20Popadi=C4=87?= Date: Wed, 25 Dec 2013 12:03:01 +0100 Subject: [PATCH] Fix a boundary case for wrap off Test Plan: vttest, 2 -> the last "*" is missing Reviewers: billiob Differential Revision: https://phab.enlightenment.org/D411 --- src/bin/termptyops.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index ebdf3683..cbd100d0 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -226,17 +226,16 @@ _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len) unsigned char offset = 1; ty->state.wrapnext = 0; - ty->state.cx++; - if (ty->state.cx >= (ty->w - 1)) return; #if defined(SUPPORT_DBLWIDTH) if (EINA_UNLIKELY(cells[ty->state.cx].att.dblwidth)) - { - ty->state.cx++; - offset = 2; - } + offset = 2; #endif - if (ty->state.cx >= (ty->w - (offset - 1))) - ty->state.cx = ty->w - offset; + ty->state.cx += offset; + if (ty->state.cx > (ty->w - offset)) + { + ty->state.cx = ty->w - offset; + return; + } } } }