From 8e0e899cb68466a11444cffbfd35498aab1296bd Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 19 Mar 2008 19:17:22 +0100 Subject: [PATCH] remove workarounds for old bug in SLsmg_write_nstring --- checkboxtree.c | 12 +----------- entry.c | 9 ++------- listbox.c | 11 +---------- 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/checkboxtree.c b/checkboxtree.c index 9c37756..418ae18 100644 --- a/checkboxtree.c +++ b/checkboxtree.c @@ -491,17 +491,7 @@ static void ctDraw(newtComponent co) { currRow = co->top + i; } - j = 4 + (3 * (*item)->depth); - SLsmg_write_nstring(NULL, co->width - j); - newtGotorc(co->top + i, co->left + j); - if (wstrlen((*item)->text, -1) > co->width - j) { - char *tmp; - tmp = strdup((*item)->text); - trim_string(tmp, co->width - j); - SLsmg_write_string(tmp); - free(tmp); - } else - SLsmg_write_string((*item)->text); + SLsmg_write_nstring((*item)->text, co->width - 4 - (3 * (*item)->depth)); item++; i++; diff --git a/entry.c b/entry.c index fc2382f..5585ce5 100644 --- a/entry.c +++ b/entry.c @@ -233,13 +233,8 @@ static void entryDraw(newtComponent co) { SLsmg_write_char('_'); i++; } - } else { - char *tmp; - tmp = strdup(chptr); - trim_string(tmp, co->width); - SLsmg_write_string(tmp); - free(tmp); - } + } else + SLsmg_write_nstring(chptr, co->width); newtGotorc(co->top, co->left + wstrlen(en->buf+en->firstChar, en->cursorPosition - en->firstChar)); } diff --git a/listbox.c b/listbox.c index 1a77e0e..6b6bb42 100644 --- a/listbox.c +++ b/listbox.c @@ -529,16 +529,7 @@ static void listboxDraw(newtComponent co) else SLsmg_set_color(NEWT_COLORSET_LISTBOX); - SLsmg_write_nstring(NULL, li->curWidth); - newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust); - if (wstrlen(item->text, -1) > li->curWidth) { - char *tmp; - tmp = strdup(item->text); - trim_string(tmp, li->curWidth); - SLsmg_write_string(tmp); - free(tmp); - } else - SLsmg_write_string(item->text); + SLsmg_write_nstring(item->text, li->curWidth); if (li->flags & NEWT_FLAG_MULTIPLE) { newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust); -- 2.47.2