Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion QuickLook/KeystrokeDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected KeystrokeDispatcher()
_validKeys =
[
Keys.Up, Keys.Down, Keys.Left, Keys.Right,
Keys.Enter, Keys.Space, Keys.Escape, Keys.F11
Keys.Enter, Keys.Space, Keys.Escape, Keys.F5, Keys.F11
];
}

Expand Down Expand Up @@ -136,6 +136,10 @@ private void InvokeRoutine(Keys key, bool isKeyDown)
PipeServerManager.SendMessage(PipeMessages.Toggle);
break;

case Keys.F5:
PipeServerManager.SendMessage(PipeMessages.Reload);
break;

case Keys.F11:
PipeServerManager.SendMessage(PipeMessages.Fullscreen);
break;
Expand Down
7 changes: 7 additions & 0 deletions QuickLook/PipeServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static class PipeMessages
public const string Close = "QuickLook.App.PipeMessages.Close";
public const string Quit = "QuickLook.App.PipeMessages.Quit";
public const string Fullscreen = "QuickLook.App.PipeMessages.Fullscreen";
public const string Reload = "QuickLook.App.PipeMessages.Reload";
}

public class PipeServerManager : IDisposable
Expand Down Expand Up @@ -168,6 +169,12 @@ private bool MessageReceived(string msg)
DispatcherPriority.ApplicationIdle);
return false;

case PipeMessages.Reload:
Application.Current.Dispatcher.BeginInvoke(

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PipeServerManager uses _lastOperation to cancel pending dispatcher work for actions that can be triggered repeatedly (e.g., Invoke/Switch/Toggle). The new Reload handler schedules a dispatcher operation but does not assign it to _lastOperation, so repeated F5 presses can enqueue multiple reloads without cancellation, potentially causing unnecessary plugin reloads and UI churn. Consider assigning the BeginInvoke result to _lastOperation here (consistent with the other preview-changing cases) so subsequent pipe messages can abort a pending reload.

Suggested change
Application.Current.Dispatcher.BeginInvoke(
_lastOperation = Application.Current.Dispatcher.BeginInvoke(

Copilot uses AI. Check for mistakes.
new Action(() => ViewWindowManager.GetInstance().ReloadPreview()),
DispatcherPriority.ApplicationIdle);
return false;

case PipeMessages.Quit:
return true;

Expand Down
2 changes: 1 addition & 1 deletion QuickLook/ViewerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
ToolTip="More">
<Button.ContextMenu>
<ContextMenu FontSize="12">
<MenuItem x:Name="moreItemReload" Tag="PinMenu">
<MenuItem x:Name="moreItemReload" Tag="PinMenu" InputGestureText="F5">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{DynamicResource SymbolThemeFontFamily}" Glyph="{x:Static ui:FontSymbols.Refresh}" />
</MenuItem.Icon>
Expand Down