diff options
author | 2025-02-12 23:17:48 +0100 | |
---|---|---|
committer | 2025-02-12 23:17:48 +0100 | |
commit | f62529747570144eb3e4822dde514d46a65b86ee (patch) | |
tree | fa21582043869d9d39006176c705cb3f3b65d20f | |
parent | 7979125ed793918dd4a0e5a1ddec8d17bffbd5bf (diff) | |
download | iced-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.rs | 31 |
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, |