Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions QuickLook/KeystrokeDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using Keyboard = System.Windows.Input.Keyboard;
using TextBoxBase = System.Windows.Controls.Primitives.TextBoxBase;

namespace QuickLook;

Expand Down Expand Up @@ -79,6 +81,18 @@ private void KeyUpEventHandler(object sender, KeyEventArgs e)

private void CallViewWindowManagerInvokeRoutine(KeyEventArgs e, bool isKeyDown)
{
// Let editable controls handle their own input, including search-panel shortcuts.
// A low-level hook runs before WPF routed key events, so e.Handled in a viewer
// cannot prevent global preview actions here. Do not consume the input itself.
if (WindowHelper.IsForegroundWindowBelongToSelf() && Keyboard.FocusedElement is TextBoxBase { IsReadOnly: false })
{
_isPreviewRequest = false;
_spaceIsDown = false;
_spaceHoldTick = 0L;
_lastInvalidKeyPressTick = 0L;
return;
}

// skip invalid keys, but record the timestamp
if (!_validKeys.Contains(e.KeyCode))
{
Expand Down