diff --git a/services/gam/src/modal/textentry.rs b/services/gam/src/modal/textentry.rs index d7286664d..37bd45769 100644 --- a/services/gam/src/modal/textentry.rs +++ b/services/gam/src/modal/textentry.rs @@ -147,7 +147,7 @@ impl ActionApi for TextEntry { _ => current_height + at_height, }; - if index as i16 == self.selected_field { + if index as i16 == self.selected_field && payloads.len() > 1 { // draw the dot let mut tv = TextView::new( modal.canvas, @@ -163,7 +163,10 @@ impl ActionApi for TextEntry { modal.gam.post_textview(&mut tv).expect("couldn't post tv"); } - let left_text_margin = modal.margin + 15; + let left_text_margin = match payloads.len() { + 1 => modal.margin, + _ => modal.margin + 15, + }; // draw the currently entered text let mut tv = TextView::new( diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index 96ccd0924..469612b5b 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -32,8 +32,9 @@ impl Modals { prompt: &str, maybe_validator: Option Option>, maybe_validator_op: Option, + placeholder: Option ) -> Result { - match self.get_text_multi(prompt, maybe_validator, maybe_validator_op, 1, None) { + match self.get_text_multi(prompt, maybe_validator, maybe_validator_op, 1, Some(vec![placeholder])) { Ok(res) => { return Ok(res.first()) }, diff --git a/services/modals/src/tests.rs b/services/modals/src/tests.rs index 850f613ca..87cd9604f 100644 --- a/services/modals/src/tests.rs +++ b/services/modals/src/tests.rs @@ -81,7 +81,7 @@ pub(crate) fn spawn_test() { // 2. test the modal dialog box function log::info!("test text input"); - match modals.get_text("Test input", Some(test_validator), None) { + match modals.get_text("Test input", Some(test_validator), None, None) { Ok(text) => { log::info!("Input: {}", text.content); } diff --git a/services/status/src/time.rs b/services/status/src/time.rs index e8e4cb432..a743dc7cb 100644 --- a/services/status/src/time.rs +++ b/services/status/src/time.rs @@ -471,7 +471,7 @@ pub fn start_time_ux(sid: xous::SID) { if !tz_set { let tz = modals.get_text( t!("rtc.timezone", xous::LANG), - Some(tz_ux_validator), None + Some(tz_ux_validator), None, None ).expect("couldn't get timezone").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::info!("got tz offset {}", tz); @@ -495,42 +495,42 @@ pub fn start_time_ux(sid: xous::SID) { months = modals.get_text( t!("rtc.month", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxMonth.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxMonth.to_u32().unwrap()), None, ).expect("couldn't get month").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got months {}", months); days = modals.get_text( t!("rtc.day", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxDay.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxDay.to_u32().unwrap()), None ).expect("couldn't get month").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got days {}", days); years = modals.get_text( t!("rtc.year", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxYear.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxYear.to_u32().unwrap()), None ).expect("couldn't get month").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got years {}", years); hours = modals.get_text( t!("rtc.hour", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxHour.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxHour.to_u32().unwrap()), None ).expect("couldn't get hour").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got hours {}", hours); mins = modals.get_text( t!("rtc.minute", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxMinute.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxMinute.to_u32().unwrap()), None ).expect("couldn't get minutes").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got minutes {}", mins); secs = modals.get_text( t!("rtc.seconds", xous::LANG), - Some(rtc_ux_validator), Some(ValidatorOp::UxSeconds.to_u32().unwrap()) + Some(rtc_ux_validator), Some(ValidatorOp::UxSeconds.to_u32().unwrap()), None ).expect("couldn't get seconds").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::debug!("got seconds {}", secs); @@ -554,7 +554,7 @@ pub fn start_time_ux(sid: xous::SID) { } let tz = modals.get_text( t!("rtc.timezone", xous::LANG), - Some(tz_ux_validator), None + Some(tz_ux_validator), None, None ).expect("couldn't get timezone").as_str() .parse::().expect("pre-validated input failed to re-parse!"); log::info!("got tz offset {}", tz);