Skip to content

Commit 47ee718

Browse files
gisseheltaooceros
authored andcommitted
Fix the caret position : Dispatch the caret move with a lower priority so the QueryTextBox has the new value when the code is executed
1 parent 444f918 commit 47ee718

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ private void OnKeyDown(object sender, KeyEventArgs e)
538538

539539
private void MoveQueryTextToEnd()
540540
{
541-
Dispatcher.Invoke(() => QueryTextBox.CaretIndex = QueryTextBox.Text.Length);
541+
// QueryTextBox seems to be update with a DispatcherPriority as low as ContextIdle.
542+
// To ensure QueryTextBox is up to date with QueryText from the View, we need to Dispatch with such a priority
543+
Dispatcher.Invoke(() => QueryTextBox.CaretIndex = QueryTextBox.Text.Length, System.Windows.Threading.DispatcherPriority.ContextIdle);
542544
}
543545

544546
public void InitializeColorScheme()

0 commit comments

Comments
 (0)