Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in completion/expansion of files with LANG=C



On Sun, 8 Jan 2006 00:06:21 -0800
Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx> wrote:
> As for my patch in the grandparent email, I noticed some problems with
> it:  the manpage for mbrtowc() says that the state of the mbstate_t
> object is undefined after the function returns -1, so the code should
> reset it to a known state.  When the function returns -2, it means the
> code scanned to the end of the string without finding the end of a wide
> character, so perhaps we should treat all the remaining characters as
> invalid?

You mean output everything remaining in the string as special codes
rather than real (multibyte) characters?  Yes, that would make sense.

> 1. It looks to me like the code in wcs_nicechar() that calls
> wcswidth(&c, 1) could really just call wcwidth(c), right?  If not,
> what am I missing?

Yes, and it's the only occurrence of wcswidth(), so it would make sense
to remove it.  This would make my patch for probing for wcswidth()
redundant.

> 2. The code in mb_niceformat() calls strlen() on the "fmt" string
> returned by wcs_nicechar(), but it seems to me that it could just use
> the width that wcs_nicechar() returned, right?

I think it really needs the length of the string here.  The width
produced by wcs_nicechar() is a printing width, which isn't the same.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



Messages sorted by: Reverse Date, Date, Thread, Author