diff --git a/README.md b/README.md index 7ccb49c2d5c4a2c173fb9225e5b74850f4a7cf22..7ade1f1859b99313ce21933f86f42c02177e7740 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 4aa89e34d89d281406389099e882ed4e08c4664e..800585f2ab10098e75becaf93b6e5bdc3833bd19 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(()) }