Skip to content
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

Some strings return -1 width #6

Closed
gauteh opened this issue Mar 14, 2014 · 2 comments
Closed

Some strings return -1 width #6

gauteh opened this issue Mar 14, 2014 · 2 comments

Comments

@gauteh
Copy link

gauteh commented Mar 14, 2014

Hi, we had some issues in sup (sup-heliotrope/sup#157) and it turns out that Unicode.width returns -1 for some strings (sup-heliotrope/sup#256), example (ruby 1.9.3):

> require 'unicode'
> a = 'This is =91 a test: the first line seems to disappear from the mail body but is
still visible in the thread view.'
> Unicode.width a
=> -1
> a.length
=> 113
@blackwinter
Copy link
Owner

it's caused by the newline. what display width would you expect a multi-line string to have? you could argue that it should be the maximum width of all lines, but then again the specification for wcswidth states that it should return -1 as soon as it encounters a control character.

so i think, whatever it is you actually need, is application specific and should be handled in sup itself.

@gauteh
Copy link
Author

gauteh commented Mar 14, 2014

Sounds fair, thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants