-
Notifications
You must be signed in to change notification settings - Fork 108
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
ProgressBarStyle.ASCII does not print only one line. #75
Comments
Thanks @ImSejin !
|
I use the font 'D2Coding' that monospace font for developers. As you said, I try removing Hangul characters, then it works! Thank you. In the case of In my case,
How should I do? 😢 |
It seems that I think the way forward is to include a fix to correctly compute the space of width-2 characters (Hangul / Hiragana / Katakana / Chinese characters / etc.) |
Thanks a lot! Have a nice day. |
The principled way to deal with this is to use the Unicode's The display width for a char is 1 if it belongs to one of the property The proposed solution for this is to include a [1] https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt |
That's cool! |
Hi,I also found this problem, but it is not Korean, but Chinese characters. If the printed information exceeds the maximum length of the console, it will wrap. The root cause is to recalculate the length of the string displayed on the console, instead of directly calling String.length to simply count the number of characters as the length.I checked some materials and used the ICU4J.jar library to calculate the string display length. You can refer to the following code: <dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>68.1</version>
</dependency>
public int getStringWidth(String showText){
int width = 0;
char[] showTextChars = showText.toCharArray();
for (char showTextChar : showTextChars) {
width += getCharWidth(showTextChar);
}
return width;
}
public int getCharWidth(char c){
int width = 1;
switch (UCharacter.getIntPropertyValue(c, UProperty.EAST_ASIAN_WIDTH)) {
case UCharacter.EastAsianWidth.WIDE:
case UCharacter.EastAsianWidth.FULLWIDTH:
width = 2;
break;
default:
break;
}
return width;
} |
@fangyuzhong2016 I'm aware of the problem of East Asian characters and this will be fixed in the next version. Thanks! P.S. In your usage of
|
Fixed (did not pull in |
Released in version |
and in the case
ProgressBarStyle.COLORFUL_UNICODE_BLOCK
, block character is?
.what's happen to me?
The text was updated successfully, but these errors were encountered: