//! ANSI escape sequences for cursor movement. /// Utilities for cursor movement in the terminal. pub struct Cursor; impl Cursor { /// Generates an ANSI escape sequence to move the cursor `n` positions to the left. /// Returns an empty string if n is 0. pub fn left(n: usize) -> String { if n == 0 { return String::new(); } format!("\x1b[{n}D") } /// Generates an ANSI escape sequence to move the cursor `n` positions to the right. /// Returns an empty string if n is 0. pub fn right(n: usize) -> String { if n == 0 { return String::new(); } format!("\x1b[{n}C") } }