]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
remove workarounds for old bug in SLsmg_write_nstring
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 19 Mar 2008 18:17:22 +0000 (19:17 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 21 Mar 2008 11:58:40 +0000 (12:58 +0100)
checkboxtree.c
entry.c
listbox.c

index 9c3775685c4eba8b163bb30cf0b04f15664c343a..418ae18581d989b0035a99bf99d5d8c713445bc6 100644 (file)
@@ -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 fc2382f96ab271ce887af9430b3a0165569ffc1d..5585ce5d1a0bb1b92065ec125c9228ee390fdccc 100644 (file)
--- 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));
 }
index 1a77e0e64726d5fb9fc96986c5b88144787c6d34..6b6bb4290fdae0441da77a7f86a5294697869222 100644 (file)
--- 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);