Package: libstfl-dev Version: 0.21-2+b1 Severity: normal Tags: patch If a section of richtext contains multi-column caracters, it is overwritten by the following section.
-- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.37-rc1 (SMP w/4 CPU cores) Locale: LANG=ja_JP.eucJP, LC_CTYPE=ja_JP.eucJP (charmap=EUC-JP) Shell: /bin/sh linked to /bin/dash Versions of packages libstfl-dev depends on: ii libncursesw5-dev 5.7+20100313-4 developer's libraries for ncursesw libstfl-dev recommends no packages. libstfl-dev suggests no packages. -- no debconf information
#include <stfl.h> #include <locale.h> #include <stdio.h> #include <wchar.h> int main(void) { struct stfl_form *form; if (setlocale(LC_ALL, "") == NULL) { return 1; } form = stfl_create(L"table\n textview[t] .border:lrtb richtext:1 style_u_normal:attr=underline\n tablebr\n !input .border:lrtb .expand:h text[i]:"); while (1) { const wchar_t * const event = stfl_run(form, 0); if (event == NULL) { continue; } if (wcscmp(event, L"ENTER") == 0) { const wchar_t * const text = stfl_get(form, L"i"); stfl_modify(form, L"t", L"replace_inner", L"textview"); { static const wchar_t format[] = L"listitem text:%ls"; wchar_t buf[sizeof format - 3 + wcslen(text)]; swprintf(buf, sizeof buf / sizeof buf[0], L"listitem text:%ls", text); stfl_modify(form, L"t", L"append", buf); } } else { break; } } stfl_reset(); stfl_free(form); return 0; }
<<attachment: original.png>>
<<attachment: patched.png>>
--- stfl-0.21.orig/base.c 2009-06-19 17:27:33.000000000 +0000 +++ stfl-0.21/base.c 2010-11-13 05:37:03.261927052 +0000 @@ -681,7 +681,7 @@ unsigned int stfl_print_richtext(struct len = p1 - p; mvwaddnwstr(win, y, x, p, len); retval += len; - x += len; + x += wcswidth(p, len); if (p2) { wchar_t stylename[p2 - p1];