File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed 
Sources/CodeEditSourceEditor/CodeSuggestion Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import AppKit
99import  SwiftUI
1010
1111struct  CodeSuggestionLabelView :  View  { 
12+  static  let  HORIZONTAL_PADDING :  CGFloat  =  13 
13+ 
1214 let  suggestion :  CodeSuggestionEntry 
1315 let  labelColor :  NSColor 
1416 let  secondaryLabelColor :  NSColor 
@@ -45,7 +47,7 @@ struct CodeSuggestionLabelView: View {
4547 } 
4648 } 
4749 . padding ( . vertical,  3 ) 
48-  . padding ( . horizontal,  13 ) 
50+  . padding ( . horizontal,  Self . HORIZONTAL_PADDING ) 
4951 . buttonStyle ( PlainButtonStyle ( ) ) 
5052 } 
5153} 
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import AppKit
99
1010extension  SuggestionController  { 
1111 /// Will constrain the window's frame to be within the visible screen
12-  public  func  constrainWindowToScreenEdges( cursorRect:  NSRect )  { 
12+  public  func  constrainWindowToScreenEdges( cursorRect:  NSRect ,  font :   NSFont )  { 
1313 guard  let  window =  self . window, 
1414 let  screenFrame =  window. screen? . visibleFrame else  { 
1515 return 
@@ -18,7 +18,8 @@ extension SuggestionController {
1818 let  windowSize  =  window. frame. size
1919 let  padding :  CGFloat  =  22 
2020 var  newWindowOrigin  =  NSPoint ( 
21-  x:  cursorRect. origin. x -  Self. WINDOW_PADDING, 
21+  x:  cursorRect. origin. x -  Self. WINDOW_PADDING
22+  -  CodeSuggestionLabelView. HORIZONTAL_PADDING -  font. pointSize, 
2223 y:  cursorRect. origin. y
2324 ) 
2425
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ public final class SuggestionController: NSWindowController {
9191 self . popover =  popover
9292 }  else  { 
9393 self . showWindow ( attachedTo:  parentWindow) 
94-  self . constrainWindowToScreenEdges ( cursorRect:  cursorRect) 
94+  self . constrainWindowToScreenEdges ( cursorRect:  cursorRect,  font :  textView . font ) 
9595
9696 if  let  controller =  self . contentViewController as?  SuggestionViewController  { 
9797 controller. styleView ( using:  textView) 
                         You can’t perform that action at this time. 
           
                  
0 commit comments