From 2eb6b1cd551993dacec75500f33841fd35d311d6 Mon Sep 17 00:00:00 2001 From: TimonPost Date: Sun, 29 Jul 2018 23:17:42 +0200 Subject: [PATCH] fixed write ansi code in pos() for unix --- src/kernel/unix_kernel/terminal.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/kernel/unix_kernel/terminal.rs b/src/kernel/unix_kernel/terminal.rs index e44e917..1204d41 100644 --- a/src/kernel/unix_kernel/terminal.rs +++ b/src/kernel/unix_kernel/terminal.rs @@ -49,7 +49,7 @@ pub fn terminal_size() -> (u16, u16) { /// Get the current cursor position. pub fn pos() -> (u16, u16) { - let crossterm = Crossterm::new(); + let mut crossterm = Crossterm::new(); let input = crossterm.input(); let delimiter = b'R'; @@ -57,8 +57,7 @@ pub fn pos() -> (u16, u16) { // Where is the cursor? // Use `ESC [ 6 n`. - -// crossterm.write("\x1B[6n"); + crossterm.active_screen.write_str("\x1B[6n"); let mut buf: [u8; 1] = [0]; let mut read_chars = Vec::new();