tech-userlevel archive

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

Re: nvi i18n



hi, all.

> Thanks for spotting this.  I will need some more time and info to figure out
> the fix.  Could you send me a screen shot as well as a sample document for
> me to reproduce the problem here.

wcurses's(?) problem is default cursor position after
opening text-file by nvi-1.81.6.

this problems occur when first character(=default cursor)
in this text-file is ''wcwidth > 1'' character.

see attached archive: wcurses.tar.gz

    wcwidth_1/
        nvi.log
        screenshot.png
        test.txt

    wcwidth_2/
        nvi.log
        screenshot_BAD.png
        screenshot_OK.png
        test.txt        
    wcurses_trace_diff.txt

wcwidth_{1,2}/nvi.log aquired from following instruction:
$ CURSES_TRACE_FILE=nvi LC_ALL=ja_JP.eucJP nvi test.txt

screenshot_BAD.png just got for nvi-1.81.6 + wcurses.

screenshot_OK.png is pkgsrc/editors/nvi + pkgsrc/devel/ncursesw with
/etc/mk.conf PREFERE.ncursesw=pkgsrc PKG_OPTIONS.nvi=wide-curses.

wcurses_trace_diff.txt is diff from both wcwidth_{1,2}/nvi.log.
i'm just now reading wcurses source with this diff.
and found following changes:

Index: cr_put.c
===================================================================
RCS file: /cvsroot/src/lib/libcurses/cr_put.c,v
retrieving revision 1.25
diff -u -r1.25 cr_put.c
--- cr_put.c    28 May 2007 15:01:54 -0000      1.25
+++ cr_put.c    14 Jun 2008 08:58:55 -0000
@@ -413,7 +413,9 @@
                                    & WA_ATTRIBUTES)
                                    == curscr->wattr ) {
                                        if 
(WCOL(curscr->lines[outline]->line[outcol]) > 0) {
+#if 0
                                                
__cputwchar(curscr->lines[outline]->line[outcol].ch);
+#endif
                                                
__cursesi_putnsp(curscr->lines[outline]->line[outcol].nsp,
                                                                outline,
                                                                outcol);

may make default cursor position right place.

but unfortunately moving cursor left or right (by pressing ``h'' and ''l'')
might not work correctlly.

i suspect continuous-cell(attr=0xfc000000)'s width are added
somewhere by mistake...


BTW, i found another bugs in wcurses.

1. __init_wacs() in src/libcurses/acs.c:

159     /* Add the SUSv2 defaults (those that are not '+') */
160         lstr = setlocale( LC_ALL, "" );
161         if ((lstr != NULL) && !strcasestr( lstr, "UTF-8" )) {
...
...
193                 WACS_RARROW      = 0x2192;

setlocale(LC_ALL, "") may overwrite application's locale
by environment variable LANG, LC_ALL and so on.
use setlocale(LC_ALL, NULL) or nl_langinfo(CODESET) is prefered.

but result string from both is implementation defined behavior.
strcasestr("UTF-8") is **not portable**.
do we really need ``rich'' arrow character in UTF-8 locale?

2. __waddbytes() in src/libcurses/addbytes.c:

150                 n = mbtowc(&wc, bytes, count);

as far as library function, using mbtowc(3) is not recommended,
please use mbrtowc(3) instead.

very truly yours.
--
Takehiko NOZAKI <tnozaki%NetBSD.org@localhost>

Attachment: wcurses.tar.gz
Description: Binary data



Home | Main Index | Thread Index | Old Index