improvements

This commit is contained in:
2024-09-21 17:17:36 +02:00
parent b644df02e0
commit f47f3575de
2 changed files with 18 additions and 13 deletions
+6 -6
View File
@@ -25,10 +25,8 @@ impl Component for Input {
self.max_length
)
}
}
impl Input {
pub fn get_input(&mut self) -> String {
fn run(&mut self, x: usize, y: usize) -> String {
print!("\x1B[{};{}H", y + 2, x + 2);
let mut input = String::new();
loop {
let key = Keyboard::new().read_key();
@@ -46,8 +44,10 @@ impl Input {
print!(" ");
}
Keys::Delete => {
input.pop();
print!("\x1b[1D \x1b[1D");
if input.len() > 0 {
input.pop();
print!("\x1b[1D \x1b[1D");
}
}
_ => {}
}