fixup! Fix display issues

This commit is contained in:
Artlef 2020-11-22 20:36:11 +01:00
parent fdb701dbf1
commit 8d098c1ea4

View File

@ -283,7 +283,13 @@ fn start_display_thread(request_recv: Receiver<DisplayMessage>) {
)
.unwrap(),
DisplayMessage::Input(k) => display_key(&mut stdout, k),
DisplayMessage::RemoveLastInput => write!(stdout, "{}{}", termion::cursor::Left(1), termion::clear::AfterCursor).unwrap(),
DisplayMessage::RemoveLastInput => write!(
stdout,
"{}{}",
termion::cursor::Left(1),
termion::clear::AfterCursor
)
.unwrap(),
DisplayMessage::Debug(s) => write!(
stdout,
"{}{}{}{}{}",
@ -323,7 +329,7 @@ fn start_keyboard_input_thread(
.send(WaitingServerMsg::UserCanceled)
.unwrap();
break;
},
}
Event::Key(Key::Char('\n')) => {
display_sender.send(DisplayMessage::Enter).unwrap();
sender.send(buffer.clone()).unwrap();
@ -333,22 +339,24 @@ fn start_keyboard_input_thread(
.unwrap();
}
buffer.clear();
},
}
Event::Key(Key::Char(c)) => {
buffer.push_str(&c.to_string());
display_sender
.send(DisplayMessage::Input(Key::Char(c)))
.unwrap();
},
}
Event::Key(Key::Backspace) => {
buffer.pop();
display_sender
.send(DisplayMessage::RemoveLastInput)
.unwrap();
},
Event::Key(k) => display_sender.send(DisplayMessage::Debug(format!("unknown key {:?}", k))).unwrap(),
}
Event::Key(k) => display_sender
.send(DisplayMessage::Debug(format!("unknown key {:?}", k)))
.unwrap(),
Event::Mouse(_) => continue,
Event::Unsupported(_) => continue
Event::Unsupported(_) => continue,
};
}
});