From f62529747570144eb3e4822dde514d46a65b86ee Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 12 Feb 2025 23:17:48 +0100 Subject: Fix `request_input_method` call in `text_input` --- widget/src/text_input.rs | 31 ++++++++++++++++--------------- 1 file 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::(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, -- cgit