Preferred line length don't support Chinese!


#1

screenshot:


Unable to correct soft wrap on Chinese
Soft-wrap does not respect multi-byte strings
Soft line wrap doesn't work well for Chinese characters
Soft wrap doesn't work on wide characters (e.g. Chinese)
#2

Yes, and the soft wrap don’t support Chinese too

I think that atom count characters as line length. A Chinese character counted as 1, but it takes 2 space actually


#3

I’d recommend opening an issue. I looked a bit into what it would take to fix this, and decided it probably takes more than a couple lines. See below for what I found.

Even Googling for a proper API was hard. Finally I found the API is wcwidth in this Stackoverflow question: http://stackoverflow.com/a/9145712/53974.

Luckily enough, wcwidth javascript turns up a couple of results:
https://www.npmjs.org/package/wcwidth.js
https://gist.github.com/saitoha/4071424 (I don’t recommend it).

Now somebody just needs to use this library to determine line width.
After grepping for softWrap, I’d suggest starting around findWrapColumn, and reviewing uses of length on lines:

While at it, I’m guessing you’ll need to loop over characters. Don’t forget that a Unicode character outside the BMP takes two JavaScript characters, and other fun problems you need to handle.


#4

Hi, I’d like to know the status of this activity.
Is this progressing?
I’m seeing same issue in Japanese.
Thanks!


#5

As @Blaisorblade suggested, I’d recommend opening an Issue. Additionally, if an Issue either already exists or is opened, please paste a link to it back here so that future readers can subscribe to it.


#6

any update to this issue? Using 0.144.0 under Ubuntu 14.04, really unconvenient especially when I open markdown preview window. I lost my cursor every time when I reach end.


#7

As far as I can tell, nobody has created a bug on this. It’s kind of hard for there to be progress if that doesn’t happen.


#8

I have opened the issue @leedohm


#9

Yup, sounds like it’s doing a char count rather than a byte count