From 1803022ec602ea7a411affe7ac92dd91c4b10ab7 Mon Sep 17 00:00:00 2001 From: ema Date: Thu, 23 Apr 2026 02:28:45 +0800 Subject: [PATCH] Fix oftentimes doesn't trigger #1903 #1483 The fix prevents the first Space keydown from being locked out before it is actually handled, so subsequent Space presses are no longer discarded. --- QuickLook/KeystrokeDispatcher.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/QuickLook/KeystrokeDispatcher.cs b/QuickLook/KeystrokeDispatcher.cs index 55a4b65..9f3e0f9 100644 --- a/QuickLook/KeystrokeDispatcher.cs +++ b/QuickLook/KeystrokeDispatcher.cs @@ -46,7 +46,8 @@ internal class KeystrokeDispatcher : IDisposable _validKeys = [ Keys.Up, Keys.Down, Keys.Left, Keys.Right, - Keys.Enter, Keys.Space, Keys.Escape, Keys.F5, Keys.F11 + Keys.Enter, Keys.Space, Keys.Escape, + Keys.F5, Keys.F11, ]; } @@ -90,7 +91,7 @@ internal class KeystrokeDispatcher : IDisposable { if (_spaceIsDown) return; - _spaceIsDown = true; + _spaceHoldTick = DateTime.Now.Ticks; } @@ -109,7 +110,12 @@ internal class KeystrokeDispatcher : IDisposable { if (isKeyDown || e.KeyCode != Keys.Space || DateTime.Now.Ticks - _spaceHoldTick >= HOLD_TO_PREVIEW_DURATION) + { InvokeRoutine(e.KeyCode, isKeyDown); + + if (isKeyDown && e.KeyCode == Keys.Space) + _spaceIsDown = true; + } } // when the key has been released, reset variables