fix: fixed wrong work with the inpututil.AppendPressedKey(...).

This commit is contained in:
Andrey Parhomenko 2024-06-03 10:33:37 +05:00
parent 7c6f8f8f45
commit eda12973e9

View file

@ -233,9 +233,6 @@ func (e *Engine) Runes() []rune {
func (e *engine) updateEvents() Events { func (e *engine) updateEvents() Events {
eng := (*Engine)(e) eng := (*Engine)(e)
e.prevKeys = e.keys
e.keys = inpututil.
AppendPressedKeys(e.keys[:0])
events := Events{} events := Events{}
@ -287,6 +284,12 @@ func (e *engine) updateEvents() Events {
e.cursorPos = realPos e.cursorPos = realPos
} }
e.prevKeys = e.keys
//newKeys := []Key{e.keys[0]}
e.keys = nil
e.keys = inpututil.
AppendPressedKeys(e.keys[:0])
// Keyboard. // Keyboard.
keyDiff := diffEm(e.prevKeys, e.keys) keyDiff := diffEm(e.prevKeys, e.keys)
for _, key := range keyDiff { for _, key := range keyDiff {