From 8c80a46e5ed6e8ddec1be6ce037dacfa2c7057a7 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Sun, 25 Oct 2026 11:09:50 +0000 Subject: [PATCH] Refresh the windows once after typing, not per letter Each key press in an entry box ran Refresh, which redraws the entry window and every open tool window between two key presses. The refresh is now posted at background priority, so the key presses already queued are handled first and a burst of letters costs one refresh. Co-Authored-By: Claude Sonnet 5.5 --- src/Nonemm.App/Windows/EntryWindow.axaml.cs | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Nonemm.App/Windows/EntryWindow.axaml.cs b/src/Nonemm.App/Windows/EntryWindow.axaml.cs index ae9e612..0a435af 100644 --- a/src/Nonemm.App/Windows/EntryWindow.axaml.cs +++ b/src/Nonemm.App/Windows/EntryWindow.axaml.cs @@ -374,7 +374,29 @@ public sealed partial class EntryWindow : Window } // typing answers whatever the status bar was reporting message = ""; - Refresh(); + RefreshAfterTyping(); + } + + private bool typingRefreshPosted; + + /// Refresh redraws this window and every open tool window, which is too + /// slow to run between two key presses. It runs once the key presses + /// waiting in the queue have been handled, so fast typing costs one + /// refresh instead of one per letter. + private void RefreshAfterTyping() + { + if (typingRefreshPosted) + { + return; + } + typingRefreshPosted = true; + Dispatcher.UIThread.Post( + () => + { + typingRefreshPosted = false; + Refresh(); + }, + DispatcherPriority.Background); } /// Set by Alt+W. Releasing Alt moves focus to the menu bar, so the