Skip to main content

pad_to

Function pad_to 

Source
pub fn pad_to(line: &str, width: usize) -> String
Expand description

Pads line on the right with spaces up to width visible columns.

A line that is already width columns or wider is returned unchanged.

use shellgame::ui::text::{pad_to, visible_width};

let padded = pad_to("\x1b[1mčau\x1b[0m", 8);
assert_eq!(visible_width(&padded), 8);