diff --git a/src/input.rs b/src/input.rs index b8a5d8b..6e3c86c 100644 --- a/src/input.rs +++ b/src/input.rs @@ -8,6 +8,7 @@ use itertools::Itertools; pub fn input_text(term: &mut Term, default: &str, name: &str) -> Result { let mut text = default.to_string(); + term.show_cursor()?; write!(term, "{}: {}", name, text)?; loop { @@ -18,6 +19,7 @@ pub fn input_text(term: &mut Term, default: &str, name: &str) -> Result match key { Key::Enter => { writeln!(term)?; + term.hide_cursor()?; return Ok(text); } Key::Backspace => { diff --git a/src/main.rs b/src/main.rs index d771d9c..40e930a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,7 +55,11 @@ fn update() -> Result<()> { .iter() .map(|service| (service.name.clone(), service)) .collect_vec(); - let mut service = input_selection(&mut term, services, "Service")?.clone(); + let mut service = if services.len() == 1 { + services.first().unwrap().1.clone() + } else { + input_selection(&mut term, services, "Service")?.clone() + }; let tag = input_text(&mut term, &service.tag, "Tag")?; service.tag = tag;