summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-12 04:54:34 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-12 04:54:34 +0100
commit502c9bfbf6eb6193adf6c88abdc4cef90816a04b (patch)
tree9fb7f8e9612797fab50f7606a3c8b14ffc663dbd /native/src/widget
parent0b86c4a299d384cafca31206eac8c94f1123518d (diff)
downloadiced-502c9bfbf6eb6193adf6c88abdc4cef90816a04b.tar.gz
iced-502c9bfbf6eb6193adf6c88abdc4cef90816a04b.tar.bz2
iced-502c9bfbf6eb6193adf6c88abdc4cef90816a04b.zip
Rename `Focus::at` to `Focus::updated_at` in `text_input`
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/text_input.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index db8f25ed..f88022fa 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -432,7 +432,10 @@ where
state.is_focused.or_else(|| {
let now = Instant::now();
- Some(Focus { at: now, now })
+ Some(Focus {
+ updated_at: now,
+ now,
+ })
})
} else {
None
@@ -564,7 +567,7 @@ where
let message = (on_change)(editor.contents());
shell.publish(message);
- focus.at = Instant::now();
+ focus.updated_at = Instant::now();
return event::Status::Captured;
}
@@ -575,7 +578,7 @@ where
if let Some(focus) = &mut state.is_focused {
let modifiers = state.keyboard_modifiers;
- focus.at = Instant::now();
+ focus.updated_at = Instant::now();
match key_code {
keyboard::KeyCode::Enter
@@ -787,7 +790,7 @@ where
focus.now = now;
let millis_until_redraw = CURSOR_BLINK_INTERVAL_MILLIS
- - (now - focus.at).as_millis()
+ - (now - focus.updated_at).as_millis()
% CURSOR_BLINK_INTERVAL_MILLIS;
shell.request_redraw(
@@ -863,7 +866,8 @@ pub fn draw<Renderer>(
font.clone(),
);
- let is_cursor_visible = ((focus.now - focus.at).as_millis()
+ let is_cursor_visible = ((focus.now - focus.updated_at)
+ .as_millis()
/ CURSOR_BLINK_INTERVAL_MILLIS)
% 2
== 0;
@@ -1007,7 +1011,7 @@ pub struct State {
#[derive(Debug, Clone, Copy)]
struct Focus {
- at: Instant,
+ updated_at: Instant,
now: Instant,
}
@@ -1043,7 +1047,10 @@ impl State {
pub fn focus(&mut self) {
let now = Instant::now();
- self.is_focused = Some(Focus { at: now, now });
+ self.is_focused = Some(Focus {
+ updated_at: now,
+ now,
+ });
self.move_cursor_to_end();
}