From fcdf53afdee9cd12bf2e01c5f6e572859b9a3f96 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 6 Feb 2025 01:50:25 +0900 Subject: Set correct text size for text in preedit window --- widget/src/text_editor.rs | 12 ++++++++---- widget/src/text_input.rs | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'widget') diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index e685256b..df42d601 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -753,14 +753,18 @@ where } Update::InputMethod(update) => match update { Ime::Toggle(is_open) => { - state.preedit = - is_open.then(input_method::Preedit::new); + state.preedit = is_open.then(|| { + input_method::Preedit::new(self.text_size) + }); shell.request_redraw(); } Ime::Preedit { content, selection } => { - state.preedit = - Some(input_method::Preedit { content, selection }); + state.preedit = Some(input_method::Preedit { + content, + selection, + text_size: self.text_size, + }); shell.request_redraw(); } diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index 7be5bbd9..de957e14 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -1262,7 +1262,7 @@ where state.is_ime_open = matches!(event, input_method::Event::Opened) - .then(input_method::Preedit::new); + .then(|| input_method::Preedit::new(self.size)); shell.request_redraw(); } @@ -1273,6 +1273,7 @@ where state.is_ime_open = Some(input_method::Preedit { content: content.to_owned(), selection: selection.clone(), + text_size: self.size, }); shell.request_redraw(); -- cgit