1const CSI: &str = "\u{1b}[";
4
5pub fn down(x: u16, y: u16, button: u8) -> String {
7 format!("{CSI}<{};{};{}M", button, x + 1, y + 1)
8}
9
10pub fn up(x: u16, y: u16, button: u8) -> String {
12 format!("{CSI}<{};{};{}m", button, x + 1, y + 1)
13}
14
15pub fn motion(x: u16, y: u16) -> String {
17 format!("{CSI}<35;{};{}M", x + 1, y + 1)
18}
19
20pub fn scroll(x: u16, y: u16, up: bool) -> String {
22 let code = if up { 64 } else { 65 };
23 format!("{CSI}<{};{};{}M", code, x + 1, y + 1)
24}
25
26pub fn click(x: u16, y: u16, button: u8) -> String {
28 format!("{}{}", down(x, y, button), up(x, y, button))
29}