diff options
| author | 2025-02-12 07:36:48 +0100 | |
|---|---|---|
| committer | 2025-02-12 07:36:48 +0100 | |
| commit | 7c1123d6c9c51b54cc25cd88f7922658a42230fb (patch) | |
| tree | fc21ed7a0d0dc5bee28250f5cdd84233fbbf4557 /core | |
| parent | 89a412695af321356a6f05f9111510d35a839983 (diff) | |
| parent | 7199ed0d079de5584ec0e7c8c5e8ff88cc1453e8 (diff) | |
| download | iced-7c1123d6c9c51b54cc25cd88f7922658a42230fb.tar.gz iced-7c1123d6c9c51b54cc25cd88f7922658a42230fb.tar.bz2 iced-7c1123d6c9c51b54cc25cd88f7922658a42230fb.zip | |
Merge pull request #2790 from rhysd/adjust-preedit-size
Set correct text size for preedit window
Diffstat (limited to '')
| -rw-r--r-- | core/src/input_method.rs | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/core/src/input_method.rs b/core/src/input_method.rs index 4e8c383b..9c83b083 100644 --- a/core/src/input_method.rs +++ b/core/src/input_method.rs @@ -1,5 +1,5 @@  //! Listen to input method events. -use crate::Point; +use crate::{Pixels, Point};  use std::ops::Range; @@ -34,6 +34,8 @@ pub struct Preedit<T = String> {      pub content: T,      /// The selected range of the content.      pub selection: Option<Range<usize>>, +    /// The text size of the content. +    pub text_size: Option<Pixels>,  }  impl<T> Preedit<T> { @@ -53,6 +55,7 @@ impl<T> Preedit<T> {          Preedit {              content: self.content.as_ref().to_owned(),              selection: self.selection.clone(), +            text_size: self.text_size,          }      }  } @@ -63,6 +66,7 @@ impl Preedit {          Preedit {              content: &self.content,              selection: self.selection.clone(), +            text_size: self.text_size,          }      }  } @@ -90,13 +94,13 @@ impl InputMethod {      /// let open = InputMethod::Open {      ///     position: Point::ORIGIN,      ///     purpose: Purpose::Normal, -    ///     preedit: Some(Preedit { content: "1".to_owned(), selection: None }), +    ///     preedit: Some(Preedit { content: "1".to_owned(), selection: None, text_size: None }),      /// };      ///      /// let open_2 = InputMethod::Open {      ///     position: Point::ORIGIN,      ///     purpose: Purpose::Secure, -    ///     preedit: Some(Preedit { content: "2".to_owned(), selection: None }), +    ///     preedit: Some(Preedit { content: "2".to_owned(), selection: None, text_size: None }),      /// };      ///      /// let mut ime = InputMethod::Disabled; | 
