> Hi !
>
> I think we should write a test program using 'SLsmg_write_nchars' (or
> SLsmg_printf) to check if the bug comes from mc or slang2... Any
> volonteers?

I've tried to debug the problem a little.
Here is a bit delail of what is going on.
Running latest mc package in ru_RU_KOI8-R locale.

From function display() in mc scr/view.c :
        ...
        mblen = 1;
        mbbuf[0] = convert_to_display_c (c);

        while (mblen < MB_LEN_MAX) {
                int res;
        memset (&mbs, 0, sizeof (mbs));
        res = mbrtowc (&wc, mbbuf, mblen, &mbs);
        ...

When file contains capital cyrillic A, 'c' variable gets it (255 decimal), 
convert_to_display_c() does not change it, and later mbrtowc() converts it 
to (wchar_t) 1040
Later this 1040 is passed to view_add_character (view, wc), which is 
defined to SLsmg_write_char() in UTF8 version of mc. And 
SLsmg_write_char() puts garbage to slang screen buffer.
Then that garbage resides in slang screen buffer, until flushed to screen 
in refresh().

I hope this information would be helpful to locate the bug.

Don't have more time now to continue debugging.
Things to check:
 - is (whar_t)1040 correct value for capital cyrillic A?
 - why SLsmg_write_char() puts garbage into buffer when gets (whar_t)1040?

Nikita

Attachment: pgpnLjt5CTyYQ.pgp
Description: PGP signature

Reply via email to