From eda12973e945eddb680077b4ca326b86bddf34b2 Mon Sep 17 00:00:00 2001 From: surdeus Date: Mon, 3 Jun 2024 10:33:37 +0500 Subject: [PATCH] fix: fixed wrong work with the inpututil.AppendPressedKey(...). --- engine.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine.go b/engine.go index 89b5478..9244c23 100644 --- a/engine.go +++ b/engine.go @@ -233,9 +233,6 @@ func (e *Engine) Runes() []rune { func (e *engine) updateEvents() Events { eng := (*Engine)(e) - e.prevKeys = e.keys - e.keys = inpututil. - AppendPressedKeys(e.keys[:0]) events := Events{} @@ -286,6 +283,12 @@ func (e *engine) updateEvents() Events { } e.cursorPos = realPos } + + e.prevKeys = e.keys + //newKeys := []Key{e.keys[0]} + e.keys = nil + e.keys = inpututil. + AppendPressedKeys(e.keys[:0]) // Keyboard. keyDiff := diffEm(e.prevKeys, e.keys)