summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-12 23:17:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-12 23:17:48 +0100
commitf62529747570144eb3e4822dde514d46a65b86ee (patch)
treefa21582043869d9d39006176c705cb3f3b65d20f
parent7979125ed793918dd4a0e5a1ddec8d17bffbd5bf (diff)
downloadiced-f62529747570144eb3e4822dde514d46a65b86ee.tar.gz
iced-f62529747570144eb3e4822dde514d46a65b86ee.tar.bz2
iced-f62529747570144eb3e4822dde514d46a65b86ee.zip
Fix `request_input_method` call in `text_input`
-rw-r--r--widget/src/text_input.rs31
1 files changed, 16 insertions, 15 deletions
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index 2cad13cd..ae3dfe4c 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -1319,23 +1319,24 @@ where
let state = state::<Renderer>(tree);
if let Some(focus) = &mut state.is_focused {
- if focus.is_window_focused
- && matches!(
+ if focus.is_window_focused {
+ if matches!(
state.cursor.state(&self.value),
cursor::State::Index(_)
- )
- {
- focus.now = *now;
-
- let millis_until_redraw = CURSOR_BLINK_INTERVAL_MILLIS
- - (*now - focus.updated_at).as_millis()
- % CURSOR_BLINK_INTERVAL_MILLIS;
-
- shell.request_redraw_at(
- *now + Duration::from_millis(
- millis_until_redraw as u64,
- ),
- );
+ ) {
+ focus.now = *now;
+
+ let millis_until_redraw =
+ CURSOR_BLINK_INTERVAL_MILLIS
+ - (*now - focus.updated_at).as_millis()
+ % CURSOR_BLINK_INTERVAL_MILLIS;
+
+ shell.request_redraw_at(
+ *now + Duration::from_millis(
+ millis_until_redraw as u64,
+ ),
+ );
+ }
shell.request_input_method(&self.input_method(
state,