summaryrefslogtreecommitdiffstats
path: root/widget/src/text_input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/text_input.rs')
-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,