If you enable pixel mouse position reporting like this:
stdout.write_all(b"\x1B[?1016h").unwrap();
Then it works fine except if you move your mouse to the top of the screen, then it can report 0, and that causes this code to panic:
// See http://www.xfree86.org/current/ctlseqs.html#Mouse%20Tracking
// The upper left character position on the terminal is denoted as 1,1.
// Subtract 1 to keep it synced with cursor
let cx = next_parsed::<u16>(&mut split)? - 1;
let cy = next_parsed::<u16>(&mut split)? - 1;
Because 0 - 1 underflows. Simple hack: use saturating subtract. I suspect nobody is going to care about the difference between pixel 0 and 1.
If you enable pixel mouse position reporting like this:
Then it works fine except if you move your mouse to the top of the screen, then it can report 0, and that causes this code to panic:
Because
0 - 1
underflows. Simple hack: use saturating subtract. I suspect nobody is going to care about the difference between pixel 0 and 1.OS Linux
Terminal/Console Kitty