From be7d3f5557de76160b25a361804985cee8ae6c45 Mon Sep 17 00:00:00 2001 From: ToBinio Date: Fri, 10 Apr 2026 12:32:12 +0200 Subject: [PATCH] ux improvements --- src/input.rs | 2 ++ src/main.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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; -- 2.51.2