pub fn pad_text_to_width(
text: &str,
width: usize,
alignment: TextAlignment,
pad_char: char,
) -> StringExpand description
Pad text to a specific display width, handling Chinese/English character differences.
§Arguments
text- The text to padwidth- Target display width in terminal columnsalignment- Text alignment (Left, Right, Center)pad_char- Character to use for padding (default: space)
§Returns
Padded text string
§Examples
use cc_switch::cli::display_utils::{pad_text_to_width, TextAlignment};
assert_eq!(pad_text_to_width("Hello", 10, TextAlignment::Left, ' '), "Hello ");
assert_eq!(pad_text_to_width("你好", 10, TextAlignment::Center, ' '), " 你好 ");