mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +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
|
||||
self.keys_hit[self.selected_field as usize] = true;
|
||||
if payload.placeholder_persist && payload.placeholder.is_some() && payload.content.len() == 0 {
|
||||
if !self.keys_hit[self.selected_field as usize]
|
||||
&& payload.placeholder_persist
|
||||
&& payload.placeholder.is_some()
|
||||
&& payload.content.len() == 0 {
|
||||
// copy the placeholder into the content string before processing the backspace
|
||||
payload.content.append(payload.placeholder.unwrap().to_str()).ok();
|
||||
}
|
||||
self.keys_hit[self.selected_field as usize] = true;
|
||||
#[cfg(feature="tts")]
|
||||
{
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue