macos: finish editing tab title when the window resigns as key window

This commit is contained in:
Lukas
2026-03-03 16:34:11 +01:00
parent cb06b9b001
commit e6e5f3ffe1
2 changed files with 2 additions and 1 deletions

View File

@@ -202,6 +202,7 @@ class TerminalWindow: NSWindow {
override func resignKey() {
super.resignKey()
resetZoomTabButton.contentTintColor = .secondaryLabelColor
tabTitleEditor.finishEditing(commit: true)
}
override func becomeMain() {

View File

@@ -226,7 +226,7 @@ final class TabTitleEditor: NSObject, NSTextFieldDelegate {
if let sourceLabel {
let labelFrame = tabButton.convert(sourceLabel.bounds, from: sourceLabel)
/// The `labelFrame.minY` value changes unexpectedly after the first use,
/// The `labelFrame.minY` value changes unexpectedly after double clicking selected text,
/// I don't know exactly why, but `tabButton.bounds` appears stable enough to calculate the correct position reliably.
frame.origin.y = bounds.midY - labelFrame.height * 0.5
frame.size.height = labelFrame.height