Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for unsupported unicode chars

2014-10-28 Thread Ismael Luceno
On Sat, Oct 25, 2014 at 11:15 PM, dequis wrote: <...> > My patch: > > Just wcwidth(...) -> abs(wcwidth(...)) > > In other words: if wcwidth returns -1, interpret that as a column > width of 1. It's a bit dirty and lazy, but it works wonderfully for > most characters. <...> It's better than nothin

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for

2014-10-27 Thread Dmitrij D. Czarkoff
FRIGN said: > >> DESCRIPTION > >> The wcwidth() function returns the number of columns needed to > >> represent the wide character c. If c is a printable wide > >> character, the value is at least 0. If c > >> is null wide character (L'\0'), the value is 0. Otherwise -1

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for

2014-10-27 Thread k0ga
> That's how POSIX-2001 defines it. > > So yeah, using abs() to "catch" the invalid case is fine, but could be > refined even more. > Ok, it is true. We should catch this case, but I don't like the idea of the abs. I think the correct solution should be print the invalid character. Regards,

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for

2014-10-27 Thread FRIGN
On Mon, 27 Oct 2014 13:03:49 +0100 Marc André Tanner wrote: > POSIX states for int wcwidth(wchar_t wc): "... or return -1 (if wc > does not correspond to a printable wide-character code)." Therefore > I think a return value of -1 should be handled gracefully. I have to agree here, even though I

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for

2014-10-27 Thread Marc André Tanner
On Mon, Oct 27, 2014 at 08:21:52AM +0100, k...@shike2.com wrote: > > On 26 October 2014 19:36, Dmitrij D. Czarkoff wrote: > >> Apparently no workaround is needed - just use sane libc or avoid using > >> new codepoints until glibc fixes that. Or, if you won't feel dirty > >> after that, send a pat

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for

2014-10-27 Thread k0ga
> On 26 October 2014 19:36, Dmitrij D. Czarkoff wrote: >> Apparently no workaround is needed - just use sane libc or avoid using >> new codepoints until glibc fixes that. Or, if you won't feel dirty >> after that, send a patch to glibc instead. > > 'Just using musl' doesn't seem feasible given a

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for unsupported unicode chars

2014-10-26 Thread dequis
On 26 October 2014 19:36, Dmitrij D. Czarkoff wrote: > Apparently no workaround is needed - just use sane libc or avoid using > new codepoints until glibc fixes that. Or, if you won't feel dirty > after that, send a patch to glibc instead. 'Just using musl' doesn't seem feasible given a glibc-ba

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for unsupported unicode chars

2014-10-26 Thread Dmitrij D. Czarkoff
Hiltjo Posthuma said: > interestingly musl knows the correct character width. Apparently no workaround is needed - just use sane libc or avoid using new codepoints until glibc fixes that. Or, if you won't feel dirty after that, send a patch to glibc instead. -- Dmitrij D. Czarkoff

Re: [dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for unsupported unicode chars

2014-10-26 Thread Hiltjo Posthuma
On Sun, Oct 26, 2014 at 3:15 AM, dequis wrote: > > My patch: > > Just wcwidth(...) -> abs(wcwidth(...)) > > In other words: if wcwidth returns -1, interpret that as a column > width of 1. It's a bit dirty and lazy, but it works wonderfully for > most characters. > > I'm not sure what the "correct"

[dev] [PATCH] [st] Fix issues with wcwidth() returning -1 for unsupported unicode chars

2014-10-25 Thread dequis
Hi suckless! First, thanks for st. Been using it for a long while, still impressed at how it gets a lot of stuff right - stuff that urxvt failed miserably at. There's only one issue that has been bothering me particularly. The issue itself: Unicode characters added since unicode 5.2 (released in