macOS: fix quicklook position

Account for padding and properly calculate text baseline, since that is
the position that the NSView `showDefinition` method ultimately needs.
This commit is contained in:
Qwerasd
2024-10-15 15:40:15 -04:00
parent 4c871246dd
commit de16541bca
2 changed files with 21 additions and 8 deletions

View File

@@ -864,7 +864,7 @@ extension Ghostty {
}
// Ghostty coordinate system is top-left, convert to bottom-left for AppKit
let pt = NSMakePoint(info.tl_px_x - 2, frame.size.height - info.tl_px_y + 2)
let pt = NSMakePoint(info.tl_px_x, frame.size.height - info.tl_px_y)
let str = NSAttributedString.init(string: text, attributes: attributes)
self.showDefinition(for: str, at: pt);
}