Skip to main content

insert_lines

Macro insert_lines 

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

Insert n lines at the cursor moving them down.

Equivalent to CSI Pn L.

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

§Example

let mut buf = formatc!("{'clear}");

buf += "line 1\n";
buf += "line 2\n";
buf += codes::move_up!(1);
buf += codes::insert_lines!(2);
buf += "inserted 1\n";
buf += "inserted 2\n";

println!("{buf}");

§Result in terminal