termwiz: windows: fix bounds check for cursor positioning

This commit is contained in:
Wez Furlong committed 2020-04-05 21:00:54 -07:00
1 parent 58c07b6da0
commit 03ab5ea659
1 file changed
+2 -2
+2 -2
View File
@@ -230,8 +230,8 @@ impl ScreenBuffer {
out.flush()?;
let info = out.get_buffer_info()?;
out.set_cursor_position(
self.cursor_x as i16,
self.cursor_y as i16 + info.srWindow.Top,
self.cursor_x.min(self.cols - 1) as i16,
(self.cursor_y as i16 + info.srWindow.Top).min(self.rows as i16 - 1),
)?;
out.flush()?;
out.set_attr(self.pending_attr)?;