Skip to main content

move_up

Macro move_up 

Source
macro_rules! move_up {
    ($n:literal) => { ... };
    ($n:expr) => { ... };
}
Expand description

Moves cursor up by N positions.

Equivalent to CSI Pn A, known as CUU.

If used with literal, produces &'static str, otherwise produces String.

§Example

assert_eq!(formatc!("{'mu5}"), codes::move_up!(5));
assert_eq!(formatc!("{'md5}"), codes::move_down!(5));
assert_eq!(formatc!("{'mu}"), codes::move_up!(1));
assert_eq!(formatc!("{'md}"), codes::move_down!(1));

printcln!("{'clear}\n\nhello{'mu2}up{'md}down{'md}");

§Result in terminal