This repository was archived by the owner on Oct 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,24 @@ public EditableTextField (MacDebuggerObjectNameView nameView)
5353 this . nameView = nameView ;
5454 }
5555
56+ public override bool AcceptsFirstResponder ( )
57+ {
58+ if ( ! base . AcceptsFirstResponder ( ) )
59+ return false ;
60+
61+ // Note: The MacDebuggerObjectNameView sets the PlaceholderAttributedString property
62+ // so that it can control the font color and the baseline offset. Unfortunately, this
63+ // breaks once the NSTextField is in "edit" mode because the placeholder text ends up
64+ // being rendered as black instead of gray. By reverting to using the basic
65+ // PlaceholderString property once we enter "edit" mode, it fixes the text color.
66+ var placeholder = PlaceholderAttributedString ;
67+
68+ if ( placeholder != null )
69+ PlaceholderString = placeholder . Value ;
70+
71+ return true ;
72+ }
73+
5674 public override void DidBeginEditing ( NSNotification notification )
5775 {
5876 base . DidBeginEditing ( notification ) ;
@@ -111,7 +129,7 @@ public MacDebuggerObjectNameView (MacObjectValueTreeView treeView) : base (treeV
111129 TextField = new EditableTextField ( this ) {
112130 AutoresizingMask = NSViewResizingMask . WidthSizable ,
113131 TranslatesAutoresizingMaskIntoConstraints = false ,
114- BackgroundColor = NSColor . Clear ,
132+ DrawsBackground = false ,
115133 Bordered = false ,
116134 Editable = false
117135 } ;
Original file line number Diff line number Diff line change @@ -53,6 +53,24 @@ public EditableTextField (MacDebuggerObjectValueView valueView)
5353 this . valueView = valueView ;
5454 }
5555
56+ public override bool AcceptsFirstResponder ( )
57+ {
58+ if ( ! base . AcceptsFirstResponder ( ) )
59+ return false ;
60+
61+ // Note: The MacDebuggerObjectValueView sets the PlaceholderAttributedString property
62+ // so that it can control the font color and the baseline offset. Unfortunately, this
63+ // breaks once the NSTextField is in "edit" mode because the placeholder text ends up
64+ // being rendered as black instead of gray. By reverting to using the basic
65+ // PlaceholderString property once we enter "edit" mode, it fixes the text color.
66+ var placeholder = PlaceholderAttributedString ;
67+
68+ if ( placeholder != null )
69+ PlaceholderString = placeholder . Value ;
70+
71+ return true ;
72+ }
73+
5674 public override void DidBeginEditing ( NSNotification notification )
5775 {
5876 base . DidBeginEditing ( notification ) ;
@@ -135,7 +153,7 @@ public MacDebuggerObjectValueView (MacObjectValueTreeView treeView) : base (tree
135153 TextField = new EditableTextField ( this ) {
136154 AutoresizingMask = NSViewResizingMask . WidthSizable ,
137155 TranslatesAutoresizingMaskIntoConstraints = false ,
138- BackgroundColor = NSColor . Clear ,
156+ DrawsBackground = false ,
139157 Bordered = false ,
140158 Editable = false
141159 } ;
You can’t perform that action at this time.
0 commit comments