From 55d2657799a2fcf5fa27002db1c51d69fa8378ee Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 19 Aug 2024 19:54:46 +0800 Subject: [PATCH] ux: better line number layout --- src/Views/TextDiffView.axaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 464339d8..b2459127 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -104,7 +104,7 @@ namespace SourceGit.Views if (string.IsNullOrEmpty(lineNumber)) continue; - var y = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.TextTop) - view.VerticalOffset; + var y = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.LineMiddle) - view.VerticalOffset; var txt = new FormattedText( lineNumber, CultureInfo.CurrentCulture, @@ -112,7 +112,7 @@ namespace SourceGit.Views typeface, presenter.FontSize, presenter.Foreground); - context.DrawText(txt, new Point(Bounds.Width - txt.Width, y)); + context.DrawText(txt, new Point(Bounds.Width - txt.Width, y - txt.Height * 0.5)); } } } @@ -392,7 +392,7 @@ namespace SourceGit.Views _lineStyleTransformer = new LineStyleTransformer(this); - TextArea.TextView.Margin = new Thickness(4, 0); + TextArea.TextView.Margin = new Thickness(2, 0); TextArea.TextView.Options.EnableHyperlinks = false; TextArea.TextView.Options.EnableEmailHyperlinks = false;