Skip to content

Commit e3c9384

Browse files
committed
ux: use cloud icon instead of a + prefix for remotes in compact commit decorator
Signed-off-by: leo <longshuang@msn.cn>
1 parent 9bfe28d commit e3c9384

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/Views/CommitRefsPresenter.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public override void Render(DrawingContext context)
172172
var allowWrap = AllowWrap;
173173
var x = 1.5;
174174
var y = 0.5;
175+
var remoteIcon = CommitRefsIconCache.Instance.GetIcon(Models.DecoratorType.RemoteBranchHead);
175176

176177
context.FillRectangle(Brushes.Transparent, Bounds);
177178

@@ -214,19 +215,18 @@ public override void Render(DrawingContext context)
214215
foreach (var remote in item.Remotes)
215216
{
216217
context.DrawLine(new Pen(item.Brush), new Point(rx, y), new Point(rx, y + 16));
217-
context.DrawText(remote, new Point(rx + 4, y + 8.0 - remote.Height * 0.5));
218-
rx += remote.WidthIncludingTrailingWhitespace + 9;
218+
using (context.PushTransform(Matrix.CreateTranslation(rx + 4, y + 4)))
219+
context.DrawGeometry(fg, null, remoteIcon);
220+
context.DrawText(remote, new Point(rx + 16, y + 8.0 - remote.Height * 0.5));
221+
rx += remote.WidthIncludingTrailingWhitespace + 22;
219222
}
220223
}
221224

222225
context.DrawRectangle(null, new Pen(item.Brush), entireRect);
223226

224227
var icon = CommitRefsIconCache.Instance.GetIcon(item.Decorator.Type);
225-
if (icon != null)
226-
{
227-
using (context.PushTransform(Matrix.CreateTranslation(x + 3, y + 3)))
228-
context.DrawGeometry(fg, null, icon);
229-
}
228+
using (context.PushTransform(Matrix.CreateTranslation(x + 3, y + 3)))
229+
context.DrawGeometry(fg, null, icon);
230230

231231
x += item.Width + 4;
232232
}
@@ -337,15 +337,15 @@ protected override Size MeasureOverride(Size availableSize)
337337
if (decorator.Name.Equals(name, StringComparison.Ordinal))
338338
{
339339
var remote = new FormattedText(
340-
$"+{test.Name.Substring(0, idxOfSlash)}",
340+
test.Name.Substring(0, idxOfSlash),
341341
CultureInfo.CurrentCulture,
342342
FlowDirection.LeftToRight,
343343
typefaceRemote,
344344
labelSize,
345345
fg);
346346

347347
item.Remotes.Add(remote);
348-
item.Width += remote.Width + 9;
348+
item.Width += remote.WidthIncludingTrailingWhitespace + 22;
349349
skippedIdx.Add(j);
350350
}
351351
}

0 commit comments

Comments
 (0)