mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-27 06:30:20 +00:00
Fix bug in TUI key repeat handling
This commit is contained in:
parent
0777437243
commit
a9f286c52b
1 changed files with 6 additions and 4 deletions
|
@ -146,14 +146,16 @@ impl InnerInputState {
|
|||
.last_key_pressed
|
||||
.as_ref()
|
||||
// heuristic for guessing which presses are auto-repeating. not necessarily accurate
|
||||
.filter(|k2| k2.0.key() == k.key() && k2.1.elapsed() < MAX_REPEAT_TIME)
|
||||
.filter(|(last_data, last_instant)| {
|
||||
last_data.key() == k.key() && last_instant.elapsed() < MAX_REPEAT_TIME
|
||||
})
|
||||
.is_some();
|
||||
if is_repeating {
|
||||
let new = k.clone();
|
||||
self.last_key_pressed = Some((new, Instant::now()));
|
||||
|
||||
if is_repeating {
|
||||
*k = KeyboardData::new(k.key(), k.code(), k.location(), true, k.modifiers());
|
||||
}
|
||||
|
||||
self.last_key_pressed = Some((k.clone(), Instant::now()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue