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 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 11:09:50 +00:00
co-authored by Claude Sonnet 5.5
parent 826aa0ef97
commit 8c80a46e5e
+23 -1
View File
@@ -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