summaryrefslogtreecommitdiffstats
path: root/newt/build/newt-0.52.2-dwchar.patch
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2008-01-26 22:32:00 +0000
committer Eric Hameleers <alien@slackware.com>2008-01-26 22:32:00 +0000
commitacdb783b3208b13047cb12c26e8c44c37e4701eb (patch)
tree7200526c4342fc4af8385d9a3f2f3d9da8c8ec56 /newt/build/newt-0.52.2-dwchar.patch
parent255b272a8b2c7f9e3cbd1c31fc325aa08f699fef (diff)
downloadasb-acdb783b3208b13047cb12c26e8c44c37e4701eb.tar.gz
asb-acdb783b3208b13047cb12c26e8c44c37e4701eb.tar.xz
Initial revision
Diffstat (limited to 'newt/build/newt-0.52.2-dwchar.patch')
-rw-r--r--newt/build/newt-0.52.2-dwchar.patch128
1 files changed, 128 insertions, 0 deletions
diff --git a/newt/build/newt-0.52.2-dwchar.patch b/newt/build/newt-0.52.2-dwchar.patch
new file mode 100644
index 00000000..48c4625f
--- /dev/null
+++ b/newt/build/newt-0.52.2-dwchar.patch
@@ -0,0 +1,128 @@
+--- newt-0.52.2/checkboxtree.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/checkboxtree.c 2006-08-04 13:41:28.000000000 +0200
+@@ -490,8 +490,17 @@
+ currRow = co->top + i;
+ }
+
+- SLsmg_write_nstring((*item)->text, co->width - 4 -
+- (3 * (*item)->depth));
++ 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);
+
+ item++;
+ i++;
+--- newt-0.52.2/newt_pr.h.dwchar 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/newt_pr.h 2006-08-04 13:41:28.000000000 +0200
+@@ -82,5 +82,6 @@
+
+ int _newt_wstrlen(const char *str, int len);
+ #define wstrlen(str,len) _newt_wstrlen((str),(len))
++void trim_string(char *title, int chrs);
+
+ #endif /* H_NEWT_PR */
+--- newt-0.52.2/listbox.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/listbox.c 2006-08-04 13:41:28.000000000 +0200
+@@ -527,7 +527,16 @@
+ else
+ SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+
+- SLsmg_write_nstring(item->text, li->curWidth);
++ 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);
+
+ if (li->flags & NEWT_FLAG_MULTIPLE) {
+ newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
+--- newt-0.52.2/newt.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/newt.c 2006-08-04 13:41:28.000000000 +0200
+@@ -184,12 +184,13 @@
+ void trim_string(char *title, int chrs)
+ {
+ char *p = title;
+- int ln = chrs;
++ int ln;
+ int x = 0,y = 0;
+ wchar_t tmp;
+ mbstate_t ps;
+
+ memset(&ps, 0, sizeof(ps));
++ ln = strlen(title);
+
+ while (*p) {
+ x = mbrtowc(&tmp, p, ln, &ps);
+@@ -198,12 +199,13 @@
+ return;
+ }
+ y = wcwidth(tmp);
+- if (y > ln) {
++ if (y > chrs) {
+ *p = '\0';
+ return;
+ } else {
+ p += x;
+- ln -= y;
++ ln -= x;
++ chrs -= y;
+ }
+ }
+ }
+@@ -638,10 +640,10 @@
+ currentWindow->height = height;
+ currentWindow->title = title ? strdup(title) : NULL;
+
+- currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 3) * (height + 3));
++ currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 5) * (height + 3));
+
+ row = top - 1;
+- col = left - 1;
++ col = left - 2;
+ /* clip to the current screen bounds - msw */
+ if (row < 0)
+ row = 0;
+@@ -655,8 +657,8 @@
+ for (j = 0; j < height + 3; j++, row++) {
+ SLsmg_gotorc(row, col);
+ SLsmg_read_raw(currentWindow->buffer + n,
+- currentWindow->width + 3);
+- n += currentWindow->width + 3;
++ currentWindow->width + 5);
++ n += currentWindow->width + 5;
+ }
+
+ newtTrashScreen();
+@@ -732,7 +734,7 @@
+ row = col = 0;
+
+ row = currentWindow->top - 1;
+- col = currentWindow->left - 1;
++ col = currentWindow->left - 2;
+ if (row < 0)
+ row = 0;
+ if (col < 0)
+@@ -740,8 +742,8 @@
+ for (j = 0; j < currentWindow->height + 3; j++, row++) {
+ SLsmg_gotorc(row, col);
+ SLsmg_write_raw(currentWindow->buffer + n,
+- currentWindow->width + 3);
+- n += currentWindow->width + 3;
++ currentWindow->width + 5);
++ n += currentWindow->width + 5;
+ }
+
+ free(currentWindow->buffer);