From 2868cb8f444042bd7d80475076d2e8ff62ffefb5 Mon Sep 17 00:00:00 2001 From: gwenn <gtreguier@gmail.com> Date: Sat, 16 Jul 2016 12:20:48 +0200 Subject: [PATCH] Fix refresh on windows --- README.md | 10 ++++++++++ src/lib.rs | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ccb49c2..7ade1f18 100644 --- a/README.md +++ b/README.md @@ -107,3 +107,13 @@ Alt-BackSpace | Kill from the start of the current word, or, if between words, t - Show completion list - expose an API callable from C + +## Wine + +```sh +$ cargo run --example example --target 'x86_64-pc-windows-gnu' +... +Error: Io(Error { repr: Os { code: 6, message: "Invalid handle." } }) +$ wineconsole --backend=curses target/x86_64-pc-windows-gnu/debug/examples/example.exe +... +``` \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 4aa89e34..800585f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -202,7 +202,7 @@ impl<'out, 'prompt> State<'out, 'prompt> { let mut _count = 0; check!(kernel32::FillConsoleOutputCharacterA(handle, ' ' as winapi::CHAR, - (info.dwSize.X * info.dwSize.Y) as winapi::DWORD, // FIXME + (info.dwSize.X * (self.old_rows as i16 +1)) as winapi::DWORD, info.dwCursorPosition, &mut _count)); let mut ab = String::new(); @@ -219,6 +219,8 @@ impl<'out, 'prompt> State<'out, 'prompt> { check!(kernel32::SetConsoleCursorPosition(handle, info.dwCursorPosition)); self.cursor = cursor; + self.old_rows = end_pos.row; + Ok(()) } -- GitLab