Avoid reentrant log scrolling during Avalonia window dragging (#10271)

This commit is contained in:
Eliot the Cougar
2026-10-01 14:55:30 +03:00
committed by GitHub
parent 1a689f869c
commit a28f68c3a7
+8 -3
View File
@@ -47,9 +47,14 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
if (togScrollToEnd.IsChecked ?? true)
{
txtMsg.ScrollToEnd();
Dispatcher.UIThread.Invoke(() =>
txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0),
DispatcherPriority.Background);
// Let layout finish without a nested dispatcher loop during a native window drag.
Dispatcher.UIThread.Post(() =>
{
if (togScrollToEnd.IsChecked ?? true)
{
txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0);
}
}, DispatcherPriority.Background);
}
}