ratkit 0.2.15

A comprehensive collection of reusable TUI components for ratatui including resizable splits, tree views, markdown rendering, toast notifications, dialogs, and terminal embedding
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use unicode_width::UnicodeWidthChar;

pub fn display_width(s: &str) -> usize {
    s.chars()
        .map(|c| {
            let code = c as u32;
            if (0xF000..=0xF8FF).contains(&code) {
                2
            } else {
                UnicodeWidthChar::width(c).unwrap_or(1)
            }
        })
        .sum()
}