ux: better line number layout

This commit is contained in:
leo 2024-08-19 19:54:46 +08:00
parent ecc1414006
commit 55d2657799
No known key found for this signature in database

View file

@ -104,7 +104,7 @@ namespace SourceGit.Views
if (string.IsNullOrEmpty(lineNumber)) if (string.IsNullOrEmpty(lineNumber))
continue; 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( var txt = new FormattedText(
lineNumber, lineNumber,
CultureInfo.CurrentCulture, CultureInfo.CurrentCulture,
@ -112,7 +112,7 @@ namespace SourceGit.Views
typeface, typeface,
presenter.FontSize, presenter.FontSize,
presenter.Foreground); 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); _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.EnableHyperlinks = false;
TextArea.TextView.Options.EnableEmailHyperlinks = false; TextArea.TextView.Options.EnableEmailHyperlinks = false;