diff --git a/src/UniGetUI.Avalonia/Views/Controls/LogTextEditor.cs b/src/UniGetUI.Avalonia/Views/Controls/LogTextEditor.cs index 63791ae0a..6bd2b4e51 100644 --- a/src/UniGetUI.Avalonia/Views/Controls/LogTextEditor.cs +++ b/src/UniGetUI.Avalonia/Views/Controls/LogTextEditor.cs @@ -81,6 +81,9 @@ public void ClearLines() public void ScrollToBottom() => ScrollToEnd(); + // True when the view is pinned to the last line; used to keep auto-scroll from fighting a manual scroll-up. + public bool IsScrolledToBottom => ExtentHeight - ViewportHeight - VerticalOffset <= 1.0; + // AvaloniaEdit auto-links URLs; its default link brush is too dark to read on the dark theme. private void UpdateLinkColor() { diff --git a/src/UniGetUI.Avalonia/Views/DialogPages/OperationOutputWindow.axaml.cs b/src/UniGetUI.Avalonia/Views/DialogPages/OperationOutputWindow.axaml.cs index 50fb308f3..0cb9ac44d 100644 --- a/src/UniGetUI.Avalonia/Views/DialogPages/OperationOutputWindow.axaml.cs +++ b/src/UniGetUI.Avalonia/Views/DialogPages/OperationOutputWindow.axaml.cs @@ -24,6 +24,7 @@ private void OnOutputLinesChanged(object? sender, NotifyCollectionChangedEventAr { Dispatcher.UIThread.Post(() => { + bool wasAtBottom = OutputText.IsScrolledToBottom; if (e.Action == NotifyCollectionChangedAction.Reset) { OutputText.ClearLines(); @@ -33,7 +34,9 @@ private void OnOutputLinesChanged(object? sender, NotifyCollectionChangedEventAr foreach (LogLineItem item in e.NewItems) OutputText.AppendLine(item); } - OutputText.ScrollToBottom(); + // Only follow new output if the user hadn't scrolled up to read earlier lines. + if (wasAtBottom) + OutputText.ScrollToBottom(); }, DispatcherPriority.Background); }