Macro csi

Source
macro_rules! csi {
    ($fmt:expr $(, $args:expr)*) => { ... };
}
Expand description

Control Sequence Introducer (CSI) macro

Returns a string that starts with the CSI escape sequence (ESC + [) followed by a sequence of parameters and a command.

ยงExamples

use async_tty::csi;

let count = 1;
let cursor_up = csi!("{count}A");
assert_eq!(cursor_up, "\x1b[1A");

let x = 10;
let y = 20;
let cursor_position = csi!("{x};{y}H");
assert_eq!(cursor_position, "\x1b[10;20H");