pub fn ascii_width(text: &str) -> Option<usize>Expand description
Returns Some(width) if text is printable ASCII only, None otherwise.
This is a fast-path optimization. For printable ASCII (0x20-0x7E), display width equals byte length, so we can avoid the full Unicode width calculation.
Returns None for:
- Non-ASCII characters (multi-byte UTF-8)
- ASCII control characters (0x00-0x1F, 0x7F) which have display width 0
§Example
use ftui_text::wrap::ascii_width;
assert_eq!(ascii_width("hello"), Some(5));
assert_eq!(ascii_width("你好"), None); // Contains CJK
assert_eq!(ascii_width(""), Some(0));
assert_eq!(ascii_width("hello\tworld"), None); // Contains tab (control char)