summaryrefslogtreecommitdiffstats
path: root/widget/src/text_editor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-12 08:46:35 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-12 08:46:35 +0100
commit7979125ed793918dd4a0e5a1ddec8d17bffbd5bf (patch)
tree6633f5f9bf45d4c7378afb1480617a7a247d0a89 /widget/src/text_editor.rs
parent97f1db3783dca5a4f60a9f89668613de4dfe9edd (diff)
downloadiced-7979125ed793918dd4a0e5a1ddec8d17bffbd5bf.tar.gz
iced-7979125ed793918dd4a0e5a1ddec8d17bffbd5bf.tar.bz2
iced-7979125ed793918dd4a0e5a1ddec8d17bffbd5bf.zip
Simplify `InputMethod` API with only two states
Co-authored-by: rhysd <lin90162@yahoo.co.jp> Co-authored-by: KENZ <KENZ.gelsoft@gmail.com>
Diffstat (limited to 'widget/src/text_editor.rs')
-rw-r--r--widget/src/text_editor.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index ce5da9ef..7e40a56a 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -339,10 +339,6 @@ where
return InputMethod::Disabled;
};
- let Some(preedit) = &state.preedit else {
- return InputMethod::Allowed;
- };
-
let bounds = layout.bounds();
let internal = self.content.0.borrow_mut();
@@ -363,10 +359,10 @@ where
let position =
cursor + translation + Vector::new(0.0, f32::from(line_height));
- InputMethod::Open {
+ InputMethod::Enabled {
position,
purpose: input_method::Purpose::Normal,
- preedit: Some(preedit.as_ref()),
+ preedit: state.preedit.as_ref().map(input_method::Preedit::as_ref),
}
}
}