dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 40456591f573241372c9e62c4af6228dbff784e6
parent 801ee1ef836a4d2568e764d9f57abdae15736805
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Tue, 20 Nov 2012 23:48:39 +0100

vt: put_wc simplify memove calls

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
vt.c | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/vt.c b/vt.c @@ -1079,14 +1079,12 @@ static void put_wc(Vt *t, wchar_t wc) tmp->dirty = true; if (t->insert) { - wmemmove(tmp->text + t->curs_col + width, tmp->text + t->curs_col, - (t->cols - t->curs_col - width)); - memmove(tmp->attr + t->curs_col + width, tmp->attr + t->curs_col, - (t->cols - t->curs_col - width) * sizeof(tmp->attr[0])); - memmove(tmp->fg + t->curs_col + width, tmp->fg + t->curs_col, - (t->cols - t->curs_col - width) * sizeof(tmp->fg[0])); - memmove(tmp->bg + t->curs_col + width, tmp->bg + t->curs_col, - (t->cols - t->curs_col - width) * sizeof(tmp->bg[0])); + int offset = t->curs_col + width; + size_t len = t->cols - t->curs_col - width; + wmemmove(tmp->text + offset, tmp->text + t->curs_col, len); + memmove(tmp->attr + offset, tmp->attr + t->curs_col, len * sizeof(tmp->attr[0])); + memmove(tmp->fg + offset, tmp->fg + t->curs_col, len * sizeof(tmp->fg[0])); + memmove(tmp->bg + offset, tmp->bg + t->curs_col, len * sizeof(tmp->bg[0])); } tmp->text[t->curs_col] = wc;