@@ -121,6 +121,15 @@ public bool UseCompactBranchNames
121121 set => SetValue ( UseCompactBranchNamesProperty , value ) ;
122122 }
123123
124+ public static readonly StyledProperty < bool > HasSingleRemoteProperty =
125+ AvaloniaProperty . Register < CommitRefsPresenter , bool > ( nameof ( HasSingleRemote ) ) ;
126+
127+ public bool HasSingleRemote
128+ {
129+ get => GetValue ( HasSingleRemoteProperty ) ;
130+ set => SetValue ( HasSingleRemoteProperty , value ) ;
131+ }
132+
124133 public static readonly StyledProperty < bool > UseGraphColorProperty =
125134 AvaloniaProperty . Register < CommitRefsPresenter , bool > ( nameof ( UseGraphColor ) ) ;
126135
@@ -173,6 +182,7 @@ public override void Render(DrawingContext context)
173182 var x = 1.5 ;
174183 var y = 0.5 ;
175184 var remoteIcon = CommitRefsIconCache . Instance . GetIcon ( Models . DecoratorType . RemoteBranchHead ) ;
185+ var hasSingleRemote = HasSingleRemote ;
176186
177187 context . FillRectangle ( Brushes . Transparent , Bounds ) ;
178188
@@ -212,13 +222,23 @@ public override void Render(DrawingContext context)
212222 if ( item . Remotes . Count > 0 )
213223 {
214224 var rx = x + 20 + item . Label . WidthIncludingTrailingWhitespace + 4 ;
215- foreach ( var remote in item . Remotes )
225+
226+ if ( hasSingleRemote )
216227 {
217228 context . DrawLine ( new Pen ( item . Brush ) , new Point ( rx , y ) , new Point ( rx , y + 16 ) ) ;
218229 using ( context . PushTransform ( Matrix . CreateTranslation ( rx + 4 , y + 4 ) ) )
219230 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 ;
231+ }
232+ else
233+ {
234+ foreach ( var remote in item . Remotes )
235+ {
236+ context . DrawLine ( new Pen ( item . Brush ) , new Point ( rx , y ) , new Point ( rx , y + 16 ) ) ;
237+ using ( context . PushTransform ( Matrix . CreateTranslation ( rx + 4 , y + 4 ) ) )
238+ context . DrawGeometry ( fg , null , remoteIcon ) ;
239+ context . DrawText ( remote , new Point ( rx + 16 , y + 8.0 - remote . Height * 0.5 ) ) ;
240+ rx += remote . WidthIncludingTrailingWhitespace + 22 ;
241+ }
222242 }
223243 }
224244
@@ -268,6 +288,7 @@ protected override Size MeasureOverride(Size availableSize)
268288 }
269289
270290 var useCompactBranchNames = UseCompactBranchNames ;
291+ var hasSingleRemote = HasSingleRemote ;
271292 var typeface = new Typeface ( FontFamily ) ;
272293 var typefaceHead = new Typeface ( FontFamily , FontStyle . Normal , FontWeight . Bold ) ;
273294 var typefaceRemote = new Typeface ( FontFamily , FontStyle . Italic , FontWeight . Bold ) ;
@@ -345,7 +366,12 @@ protected override Size MeasureOverride(Size availableSize)
345366 fg ) ;
346367
347368 item . Remotes . Add ( remote ) ;
348- item . Width += remote . WidthIncludingTrailingWhitespace + 22 ;
369+
370+ if ( hasSingleRemote )
371+ item . Width += 18 ;
372+ else
373+ item . Width += remote . WidthIncludingTrailingWhitespace + 22 ;
374+
349375 skippedIdx . Add ( j ) ;
350376 }
351377 }
0 commit comments