google / google/yapf

Some letters usually shown as multi-column(Asian characters) seems to be counted as single column

Open
#714 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

```command
$ cat sample.py
haps = ["하나", "둘", "셋", "넷", "다섯", "여섯", "일곱", "여덟", "아홉", "열", "열하나", "열둘"]
haps = ["Onee", "Tw", "Th", "Fo", "Five", "Sixx", "Seve", "Eigh", "Nine", "Te", "Eleven", "Twel"]
$ yapf --style=google sample.py
haps = ["하나", "둘", "셋", "넷", "다섯", "여섯", "일곱", "여덟", "아홉", "열", "열하나", "열둘"]
haps = [
"Onee", "Tw", "Th", "Fo", "Five", "Sixx", "Seve", "Eigh", "Nine", "Te",
"Eleven", "Twel"
]
```

When I'm using vim, the first line of sample.py and the second line of sample.py, both are reported as having same number of columns, since Asian characters are usually considered as having multi-column size(2 columns, mostly).

However, it seems that yapf do not differentiate the number of columns among different characters. The second line of the sample.py is splitted as I expected but the first line of that file remained untouched.

Is this intended behavior, or would there be a plan for extend the concept of column size?

I believe that we can use East_Asian_Width property on each letter:
http://unicode.org/cldr/utility/character.jsp?a=AC00

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.