diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index d3b602c3a..1e75811db 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -155,7 +155,10 @@ public override void Render(DrawingContext context) } if (indicator != null) - context.DrawText(indicator, new Point(0, y - (indicator.Height * 0.5))); + { + var x = (Bounds.Width - indicator.Width) * 0.5; + context.DrawText(indicator, new Point(x, y - (indicator.Height * 0.5))); + } } } } @@ -167,14 +170,21 @@ protected override Size MeasureOverride(Size availableSize) return new Size(0, 0); var typeface = TextView.CreateTypeface(); - var test = new FormattedText( + var minus = new FormattedText( "-", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, presenter.FontSize, Brushes.White); - return new Size(test.Width, 0); + var plus = new FormattedText( + "+", + CultureInfo.CurrentCulture, + FlowDirection.LeftToRight, + typeface, + presenter.FontSize, + Brushes.White); + return new Size(Math.Max(minus.Width, plus.Width), 0); } protected override void OnDataContextChanged(EventArgs e)