-
Notifications
You must be signed in to change notification settings - Fork 12
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
What can support Chinese? #5
Comments
Can you give me some example text, the expected output and the actual output, so I can debug this? I added a very simple test to demonstrate that Chinese is wrapped at the column width, but other than that, I'm not sure what the problem is. https://github.com/abrookins/WrapToColumn/blob/master/src/com/andrewbrookins/idea/wrap/CodeWrapperTest.java#L98 Thanks! |
achieve the effect of the picture as you can, usually used when writing Markdown or reStructuredText format documents. test: 它是如何工作的呢?实际上,每个bundle在定义自己的服务配置都是跟目前为止你看到的是一样的。换句话说,一个bundle使用一个或者多个配置资源文件(通常是XML)来指定bundle所需要的参数和服务。然而,我们不直接在配置文件中使用 |
Ah, yes, I see the problem now. The code is wrapping at 80 characters, but this doesn't account for the real size each code point takes up on the line. I will dig into this in my spare time. |
I looked into this problem more. Basically the font glyphs are variable-width, but Intellij's right margin guide (the visual bar) and the reflow algorithm in this plugin are based on monospaced characters. Even though Intellij shows a right margin guide, it's positioned based on the width of a line of monospaced characters -- so Chinese glyphs are shown as spilling over the margin even if the characters, when considered as single-column width (i.e. monospace) are in total narrower than the right margin. The only way I could think to wrap variable width text correctly would be to reflow it based on its display width (using something like Swing's FontMetrics) and the visual position of the right margin guide. That doesn't seem worth the effort to me, though I might pick it up again someday. Instead of doing that, I've added an explicit mention about variable width fonts to the README explaining that wrapping them probably won't work correctly. |
This is not as simple as I thought. Even while treating Chinese characters as taking a single column, the wrapping algorithm performs poorly because it considers only the space character as a word separator. |
I like this tool, but not support Chinese.
The text was updated successfully, but these errors were encountered: