code_review: PR #182

* avoid highlight trailing ellipsis
* use WidthIncludingTrailingWhitespace instead of Width to keep original white space in translation
* add same modification on zh_CN and zh_TW
This commit is contained in:
leo 2024-06-18 10:13:39 +08:00
parent f9d62c5329
commit f79dc1f91f
No known key found for this signature in database
GPG key ID: B528468E49CD0E58
4 changed files with 56 additions and 59 deletions

View file

@ -81,7 +81,6 @@ namespace SourceGit.Views
return;
var normalTypeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal, FontStretch.Normal);
//var highlightTypeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold, FontStretch.Normal);
var underlinePen = new Pen(Foreground, 1);
var offsetX = 0.0;
@ -99,7 +98,6 @@ namespace SourceGit.Views
part,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
//isName ? highlightTypeface : normalTypeface,
normalTypeface,
FontSize,
Foreground);
@ -107,15 +105,14 @@ namespace SourceGit.Views
if (isName)
{
var lineY = formatted.Baseline + 2;
offsetX += 4;
context.DrawText(formatted, new Point(offsetX, 0));
context.DrawLine(underlinePen, new Point(offsetX, lineY), new Point(offsetX + formatted.Width, lineY));
offsetX += formatted.Width + 4;
offsetX += formatted.WidthIncludingTrailingWhitespace;
}
else
{
context.DrawText(formatted, new Point(offsetX, 0));
offsetX += formatted.Width;
offsetX += formatted.WidthIncludingTrailingWhitespace;
}
isName = !isName;