Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit bb2d51e

Browse files
committed
Fix font
1 parent 61dc150 commit bb2d51e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
using Microsoft.VisualStudio.Text;
3838
using Microsoft.VisualStudio.Utilities;
3939
using Microsoft.VisualStudio.Text.Editor;
40+
using Microsoft.VisualStudio.Text.Classification;
4041

4142
namespace MonoDevelop.Debugger
4243
{
@@ -101,10 +102,19 @@ public MacDebuggerObjectNameView (MacObjectValueTreeView treeView) : base (treeV
101102
textBufferFactory = CompositionManager.Instance.GetExportedValue<ITextBufferFactoryService> ();
102103
var factory = CompositionManager.Instance.GetExportedValue<ICocoaTextEditorFactoryService> ();
103104
contentType = contentTypeRegistry.GetContentType (DebuggerCompletion.ContentType);
105+
var editorFormatMapService = CompositionManager.Instance.GetExportedValue<IEditorFormatMapService> ();
106+
var appearanceCategory = Guid.NewGuid ().ToString ();
107+
var editorFormat = editorFormatMapService.GetEditorFormatMap (appearanceCategory);
108+
109+
var resourceDictionary = editorFormat.GetProperties ("Plain Text");
110+
resourceDictionary [ClassificationFormatDefinition.TypefaceId] = TextField.Font;
111+
resourceDictionary [ClassificationFormatDefinition.FontRenderingSizeId] = TextField.Font.PointSize - 1;
112+
editorFormat.SetProperties ("Plain Text", resourceDictionary);
113+
104114
var textBuffer = textBufferFactory.CreateTextBuffer ("", contentType);
105115
editor = factory.CreateTextView (textBuffer);
106116
editor.Options.SetOptionValue(DefaultTextViewOptions.UseVisibleWhitespaceId, false);
107-
117+
editor.Options.SetOptionValue (DefaultTextViewOptions.AppearanceCategory, appearanceCategory);
108118
editor.VisualElement.TranslatesAutoresizingMaskIntoConstraints = false;
109119
editorTextView = new NSView { TranslatesAutoresizingMaskIntoConstraints = false, WantsLayer = true };
110120
editorTextView.Layer.BackgroundColor = NSColor.White.CGColor;
@@ -273,8 +283,8 @@ protected override void UpdateContents ()
273283
AddSubview (textView);
274284
}
275285

276-
constraints.Add (textView.TopAnchor.ConstraintEqualToAnchor (TopAnchor, -1));
277-
constraints.Add (textView.BottomAnchor.ConstraintEqualToAnchor (BottomAnchor, -1));
286+
constraints.Add (textView.TopAnchor.ConstraintEqualToAnchor (TopAnchor, (nfloat)editor.FormattedLineSource.BaseIndentation));
287+
constraints.Add (textView.BottomAnchor.ConstraintEqualToAnchor (BottomAnchor, (nfloat)editor.FormattedLineSource.BaseIndentation));
278288
} else {
279289
textView = TextField;
280290

0 commit comments

Comments
 (0)