-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should combining characters return -1 or 0 ? #1
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks , that's just the kind of feedback I was looking for ..
I chose to return -1 because thats what libc wcwidth(3) returns on my OSX and travis-ci.org's linux systems
(unless I'm doing it wrong, bin/wcwidth-libc-comparator.py),
Although there are a few cases where libc returns 1 where wcwidth.py returns -1, there aren't any cases of libc returning 0 ..
Matching values:
libc 1 vs. wcwidth.py -1:
Anyway you may be right .. I was hoping for some feedback.
My thoughts were:: If somebody wants to know the printable width of a string, and it contains a combining, until I fully understand their effect in full string as part of wcswidth, I should return -1 as if to say "indeterminate".
Examining a few consumers of wcwidth.c, they often return 0 in such cases, one example:
Anyway, feedback appreciated. I'll open a bug, reading http://pubs.opengroup.org/onlinepubs/009696699/functions/wcwidth.html it seems it should return -1 for anything but wide characters and NULL.
jq
On May 5, 2014, at 12:24 AM, wrote:
Hi Mr Quast,
I was wondering if there was a reason behind your choice to return -1 for combining characters when in the original C code it returned 0.
Regards,
The text was updated successfully, but these errors were encountered: