pub struct CharWidthTable {
pub cjk: u8,
pub emoji: u8,
pub nerd_font: u8,
pub terminal: TerminalType,
/* private fields */
}Expand description
Character width table with caching
Fields§
§cjk: u8Width for CJK characters
emoji: u8Width for emoji
nerd_font: u8Width for nerd font icons
terminal: TerminalTypeDetected terminal type
Implementations§
Source§impl CharWidthTable
impl CharWidthTable
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect character widths from terminal environment
This detects the terminal type from environment variables and sets appropriate default widths for emoji, CJK, and nerd fonts.
Note: This is a heuristic based on known terminal behaviors. For precise width detection, some terminals support querying character widths via escape sequences, but this is not universally supported and may cause issues in some environments.
Sourcepub fn for_terminal(terminal: TerminalType) -> Self
pub fn for_terminal(terminal: TerminalType) -> Self
Create for a specific terminal type
Sourcepub fn set_override(&mut self, ch: char, width: u8)
pub fn set_override(&mut self, ch: char, width: u8)
Override width for specific character
Sourcepub fn with_emoji(self, width: u8) -> Self
pub fn with_emoji(self, width: u8) -> Self
Set emoji width
Sourcepub fn with_nerd_font(self, width: u8) -> Self
pub fn with_nerd_font(self, width: u8) -> Self
Set nerd font width
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CharWidthTable
impl RefUnwindSafe for CharWidthTable
impl Send for CharWidthTable
impl Sync for CharWidthTable
impl Unpin for CharWidthTable
impl UnsafeUnpin for CharWidthTable
impl UnwindSafe for CharWidthTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more