fixed write ansi code in pos() for unix

This commit is contained in:
TimonPost 2018-07-29 23:17:42 +02:00
parent bf0f330b8f
commit 2eb6b1cd55

View File

@ -49,7 +49,7 @@ pub fn terminal_size() -> (u16, u16) {
/// Get the current cursor position. /// Get the current cursor position.
pub fn pos() -> (u16, u16) { pub fn pos() -> (u16, u16) {
let crossterm = Crossterm::new(); let mut crossterm = Crossterm::new();
let input = crossterm.input(); let input = crossterm.input();
let delimiter = b'R'; let delimiter = b'R';
@ -57,8 +57,7 @@ pub fn pos() -> (u16, u16) {
// Where is the cursor? // Where is the cursor?
// Use `ESC [ 6 n`. // Use `ESC [ 6 n`.
crossterm.active_screen.write_str("\x1B[6n");
// crossterm.write("\x1B[6n");
let mut buf: [u8; 1] = [0]; let mut buf: [u8; 1] = [0];
let mut read_chars = Vec::new(); let mut read_chars = Vec::new();