term.js icon indicating copy to clipboard operation
term.js copied to clipboard

Additional wide characters

Open takluyver opened this issue 9 years ago • 5 comments

Originally reported as ipython/ipython#8361 - 啊, U+554A, displays wider than a standard character, at least in the monospace font used in my browser. Using it term.js therefore breaks the layout. Adding it to isWide() fixes things. It's a Han character, and I assume that many of the nearby codepoints will behave similarly. But I don't know how many, or whether there are other fonts that fit them into a standard width.

takluyver avatar Apr 30 '15 18:04 takluyver

There is a Python library wcwidth with tables of wide and combining characters; this could be adapted to JS.

takluyver avatar May 21 '15 22:05 takluyver

@takluyver, JS will be a bit different since it's utf-16 and has to deal with surrogate pairs as well. I've implement wide chars, surrogate pairs, and zero-width combining chars for blessed: https://github.com/chjj/blessed/blob/master/lib/unicode.js

That's, in a way, sort of the inverse of what we want to do here, but the unicode library above will be useful. It's a compilation of a number of helpful unicode modules for node.

chjj avatar May 21 '15 23:05 chjj

here is what you want https://github.com/chjj/term.js/pull/72

liuzheng avatar Jun 04 '15 16:06 liuzheng

I spotted this blog post about the challenges of trying to fit unicode characters to a monospace grid: http://denisbider.blogspot.co.uk/2015/09/when-monospace-fonts-arent-unicode.html

takluyver avatar Sep 12 '15 09:09 takluyver

Does my Pull-Request that support CJK languages help ? https://github.com/chjj/term.js/pull/97

yoshiokatsuneo avatar Nov 09 '15 08:11 yoshiokatsuneo