Re: wcwidth() fixes in libedit

2011-04-04 Thread Nicholas Marriott
Hi This is fine with me. On Mon, Apr 04, 2011 at 09:04:26PM +0200, Stefan Sperling wrote: > On Mon, Apr 04, 2011 at 06:44:10PM +, Miod Vallat wrote: > > > > Would it be better maybe to do the check in the Width() macro itself? > > > > > > Yes indeed. New diff below. > > > > > -#define Widt

Re: wcwidth() fixes in libedit

2011-04-04 Thread Stefan Sperling
On Mon, Apr 04, 2011 at 06:44:10PM +, Miod Vallat wrote: > > > Would it be better maybe to do the check in the Width() macro itself? > > > > Yes indeed. New diff below. > > > -#define Width(c) wcwidth(c) > > +#define Width(c) (wcwidth(c) == -1 ? 0 : wcwidth(c)) > > But this calls wcwidth

Re: wcwidth() fixes in libedit

2011-04-04 Thread Miod Vallat
> > Would it be better maybe to do the check in the Width() macro itself? > > Yes indeed. New diff below. > -#define Width(c) wcwidth(c) > +#define Width(c) (wcwidth(c) == -1 ? 0 : wcwidth(c)) But this calls wcwidth() to be invoked twice, which is ugly. As a minimum, make this an inline

Re: wcwidth() fixes in libedit

2011-04-04 Thread Nicholas Marriott
This is ok nicm I wouldn't be surprised if WIDECHAR build of libedit has other issues, getting it going is still on my list of things to do :-). On Mon, Apr 04, 2011 at 08:30:42PM +0200, Stefan Sperling wrote: > On Sun, Apr 03, 2011 at 11:26:52PM +0100, Nicholas Marriott wrote: > > Hi > > > > W

Re: wcwidth() fixes in libedit

2011-04-04 Thread Stefan Sperling
On Sun, Apr 03, 2011 at 11:26:52PM +0100, Nicholas Marriott wrote: > Hi > > We don't currently build a wide char libedit but comments inline: > > On Sun, Apr 03, 2011 at 11:46:24PM +0200, Stefan Sperling wrote: > > These callers in libedit might get confused if wcwidth() returns -1. > > > > Note

Re: wcwidth() fixes in libedit

2011-04-03 Thread Nicholas Marriott
Hi We don't currently build a wide char libedit but comments inline: On Sun, Apr 03, 2011 at 11:46:24PM +0200, Stefan Sperling wrote: > These callers in libedit might get confused if wcwidth() returns -1. > > Note how the result ct_visual_width() is used in refresh.c: > > refresh.c:

wcwidth() fixes in libedit

2011-04-03 Thread Stefan Sperling
These callers in libedit might get confused if wcwidth() returns -1. Note how the result ct_visual_width() is used in refresh.c: refresh.c: h += ct_visual_width(*cp); Index: chartype.c === RCS file: /cvs/src/li