|
|
|
@ -198,18 +198,23 @@ fn main() -> Result<()> {
|
|
|
|
|
if !event.char.is_control() {
|
|
|
|
|
line.insert(event.char);
|
|
|
|
|
|
|
|
|
|
let mut buf = [0 as u8; 8];
|
|
|
|
|
let s = event.char.encode_utf8(&mut buf);
|
|
|
|
|
let tail = line.tail();
|
|
|
|
|
let n = tail.chars().count();
|
|
|
|
|
|
|
|
|
|
// write everything from the current line cursor out to the output buffer. Then
|
|
|
|
|
// rewind the cursor in the output buffer to where it was.
|
|
|
|
|
unsafe {
|
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
|
stdout,
|
|
|
|
|
s.as_bytes(),
|
|
|
|
|
tail.as_bytes(),
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
))?;
|
|
|
|
|
|
|
|
|
|
if n > 1 {
|
|
|
|
|
let text = format!("\x1b[{}D", n-1);
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -220,7 +225,7 @@ fn main() -> Result<()> {
|
|
|
|
|
debug!("back!");
|
|
|
|
|
line.back();
|
|
|
|
|
unsafe {
|
|
|
|
|
let text = "\x1b[D";
|
|
|
|
|
let text = "\x1b[D"; // lol this sucks
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|