mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
don't restore default text if field is cleared with backspace
even if persist is set, if the field has been edited, don't restore the default text. otherwise, the default text re-appears if you backspace to an empty string.
This commit is contained in:
parent
c8ec87b2d6
commit
f0e1597b5c
1 changed files with 5 additions and 2 deletions
|
|
@ -490,11 +490,14 @@ impl ActionApi for TextEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => { // text entry
|
_ => { // text entry
|
||||||
self.keys_hit[self.selected_field as usize] = true;
|
if !self.keys_hit[self.selected_field as usize]
|
||||||
if payload.placeholder_persist && payload.placeholder.is_some() && payload.content.len() == 0 {
|
&& payload.placeholder_persist
|
||||||
|
&& payload.placeholder.is_some()
|
||||||
|
&& payload.content.len() == 0 {
|
||||||
// copy the placeholder into the content string before processing the backspace
|
// copy the placeholder into the content string before processing the backspace
|
||||||
payload.content.append(payload.placeholder.unwrap().to_str()).ok();
|
payload.content.append(payload.placeholder.unwrap().to_str()).ok();
|
||||||
}
|
}
|
||||||
|
self.keys_hit[self.selected_field as usize] = true;
|
||||||
#[cfg(feature="tts")]
|
#[cfg(feature="tts")]
|
||||||
{
|
{
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue