From c97ece93a72d02e2b2974c622d2a5c36937a6ae5 Mon Sep 17 00:00:00 2001 From: Philippe Miossec Date: Wed, 29 May 2019 18:16:23 +0200 Subject: [PATCH] New height estimation (proposed in https://github.com/gitextensions/gitextensions/issues/6605#issuecomment-496314608 ) Don't know if it solves something... --- GitUI/Editor/BlameAuthorMargin.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/GitUI/Editor/BlameAuthorMargin.cs b/GitUI/Editor/BlameAuthorMargin.cs index b77c269e778..6c23f346eeb 100644 --- a/GitUI/Editor/BlameAuthorMargin.cs +++ b/GitUI/Editor/BlameAuthorMargin.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Drawing; using System.Linq; +using System.Windows.Forms; using GitExtUtils.GitUI; using ICSharpCode.TextEditor; using Microsoft.VisualStudio.Threading; @@ -18,10 +20,19 @@ public class BlameAuthorMargin : AbstractMargin public BlameAuthorMargin(TextArea textArea) : base(textArea) { - _lineHeight = textArea.Font.Height + 1; + _lineHeight = GetFontHeight(textArea.Font); _backgroundColor = ((SolidBrush)SystemBrushes.Window).Color; } + private static int GetFontHeight(Font font) + { + var max = Math.Max( + TextRenderer.MeasureText("_", font).Height, + (int)Math.Ceiling(font.GetHeight())); + + return max + 1; + } + public void SetAvatars(List> avatars) { _avatars = avatars.Select(a => ThreadHelper.JoinableTaskFactory.Run(async () => await a)).ToList();