Package org.jline.utils
Class WCWidth
- java.lang.Object
-
- org.jline.utils.WCWidth
-
public final class WCWidth extends java.lang.Object
Utility class for determining the display width of Unicode characters.The WCWidth class provides methods for calculating the display width of Unicode characters in terminal environments. This is important for proper text alignment and cursor positioning, especially when dealing with wide characters (such as East Asian characters) and zero-width characters (such as combining marks).
This implementation is based on Markus Kuhn's wcwidth implementation, which follows the Unicode Standard guidelines for character width. It categorizes characters as:
- Zero width (0) - Control characters, combining marks, format characters
- Single width (1) - Most Latin, Greek, Cyrillic, and other scripts
- Double width (2) - East Asian scripts (Chinese, Japanese, Korean)
- Ambiguous width (-1) - Characters with context-dependent width
This class is used throughout JLine for calculating string display widths, which is essential for proper terminal display formatting, cursor positioning, and text alignment.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
wcwidth(int ucs)
-