2
0
mirror of https://github.com/xvxx/phetch synced 2024-11-05 00:00:58 +00:00

ctrl-c/esc just cancels, doesnt clear

This commit is contained in:
dvkt 2020-01-08 16:33:57 -08:00
parent 5bec1c274a
commit a5d9c1c93e

View File

@ -377,18 +377,14 @@ impl UI {
}
Key::Char(c) => input.push(c),
Key::Esc | Key::Ctrl('c') => {
if input.is_empty() {
write!(
out,
"{}{}",
termion::clear::CurrentLine,
termion::cursor::Hide
);
out.flush();
return None;
} else {
input.clear();
}
write!(
out,
"{}{}",
termion::clear::CurrentLine,
termion::cursor::Hide
);
out.flush();
return None;
}
Key::Backspace | Key::Delete => {
input.pop();