nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] UTF-8 problem in topwin


From: David Lawrence Ramsey
Subject: Re: [Nano-devel] UTF-8 problem in topwin
Date: Fri, 25 Mar 2005 00:14:28 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Jordi Mallach wrote:

Hi,

Using 1.3.6, I see that if a translation has an accented character in
the "New Buffer" string, as Catalan does (Nou búfer), nano will eat the
final character in that string.

Ie, instead of seeing "Nou búfer" in the topwin, I see "Nou búfe".
Oops. Apparently I forgot that some of the (mv)?waddnstr() calls in titlebar() still operate under the assumption that one character is one byte. The attached patch fixes that (and it's already in CVS). Thanks for the report.

diff -ur nano-1.3.6/src/winio.c nano-1.3.6-fixed/src/winio.c
--- nano-1.3.6/src/winio.c      2005-03-19 16:15:30.000000000 -0500
+++ nano-1.3.6-fixed/src/winio.c        2005-03-25 00:07:51.000000000 -0500
@@ -2811,7 +2811,7 @@
 
        /* There is room for the whole filename, so we center it. */
        waddnstr(topwin, hblank, (space - exppathlen) / 3);
-       waddnstr(topwin, prefix, prefixlen);
+       waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
        if (!newfie) {
            assert(strlenpt(prefix) + 1 == prefixlen);
 
@@ -2820,7 +2820,7 @@
        }
     } else {
        /* We will say something like "File: ...ename". */
-       waddnstr(topwin, prefix, prefixlen);
+       waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
        if (space <= -3 || newfie)
            goto the_end;
        waddch(topwin, ' ');
@@ -2834,11 +2834,12 @@
     free(exppath);
 
     if (COLS <= 1 || statelen >= COLS - 1)
-       mvwaddnstr(topwin, 0, 0, state, COLS);
+       mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
     else {
        assert(COLS - statelen - 2 >= 0);
        mvwaddch(topwin, 0, COLS - statelen - 2, ' ');
-       mvwaddnstr(topwin, 0, COLS - statelen - 1, state, statelen);
+       mvwaddnstr(topwin, 0, COLS - statelen - 1, state,
+               actual_x(state, statelen));
     }
 
     wattroff(topwin, A_REVERSE);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]