|
|
|
@ -201,8 +201,7 @@ fn main() -> Result<()> {
|
|
|
|
|
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.
|
|
|
|
|
// write everything from the current line cursor out to the output buffer.
|
|
|
|
|
unsafe {
|
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
|
stdout,
|
|
|
|
@ -211,6 +210,8 @@ fn main() -> Result<()> {
|
|
|
|
|
None,
|
|
|
|
|
))?;
|
|
|
|
|
|
|
|
|
|
// if we wrote more than one character, because we weren't at the end, we
|
|
|
|
|
// need to rewind the terminal cursor to where it was.
|
|
|
|
|
if n > 1 {
|
|
|
|
|
let text = format!("\x1b[{}D", n-1);
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
@ -222,13 +223,21 @@ fn main() -> Result<()> {
|
|
|
|
|
debug!("Unhandled Keyboard Event: {}", event);
|
|
|
|
|
}
|
|
|
|
|
input::Event::Left => {
|
|
|
|
|
debug!("back!");
|
|
|
|
|
line.back();
|
|
|
|
|
unsafe {
|
|
|
|
|
let text = "\x1b[D"; // lol this sucks
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
|
if line.back() {
|
|
|
|
|
unsafe {
|
|
|
|
|
let text = "\x1b[D"; // lol this sucks
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
input::Event::Right => {
|
|
|
|
|
if line.forward() {
|
|
|
|
|
unsafe {
|
|
|
|
|
let text = "\x1b[C"; // lol this sucks
|
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
input::Event::Focus(true) => {},
|
|
|
|
|
input::Event::Focus(false) => {},
|
|
|
|
|
input::Event::Menu(_command_id) => {},
|
|
|
|
|