From ec9fdb0e4237610ad6465887f08d9cc1693ae986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gianguido=20Sor=C3=A0?= Date: Thu, 7 Apr 2022 17:05:19 +0200 Subject: [PATCH] make text entry work pro tip: make sure your types are synchronized between Buffer calls! --- services/modals/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/modals/src/main.rs b/services/modals/src/main.rs index 5ba2c8371..69684abb6 100644 --- a/services/modals/src/main.rs +++ b/services/modals/src/main.rs @@ -304,7 +304,12 @@ fn xmain() -> ! { #[cfg(feature="tts")] tts.tts_simple(config.prompt.as_str().unwrap()).unwrap(); renderer_modal.modify( - Some(ActionType::TextEntry(text_action.clone())), + Some(ActionType::TextEntry({ + let mut ta = text_action.clone(); + ta.reset_action_payloads(config.fields, config.placeholders); + + ta + })), Some(config.prompt.as_str().unwrap()), false, None, true, None ); @@ -477,7 +482,7 @@ fn xmain() -> ! { RendererState::RunText(_config) => { log::trace!("validating text entry modal"); let buf = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; - let text = buf.to_original::().unwrap(); + let text = buf.to_original::().unwrap(); if let Some(mut origin) = dr.take() { let mut response = unsafe { Buffer::from_memory_message_mut(origin.body.memory_message_mut().unwrap()) }; response.replace(text).unwrap();