Skip to content

Commit

Permalink
Add comments/docs and make method name clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
peteschaffner committed Feb 7, 2024
1 parent 591c056 commit 93fb852
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion macos/Sources/Features/Terminal/TerminalWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ class TerminalWindow: NSWindow {
// The tab bar controller ID from macOS
static private let TabBarController = NSUserInterfaceItemIdentifier("_tabBarController")

// Look through the titlebar's view hierarchy and hide any of the internal
// views used to create a separator between the title/toolbar and unselected
// tabs in the tab bar.
override func updateConstraintsIfNeeded() {
super.updateConstraintsIfNeeded()

guard let titlebarContainer = contentView?.superview?.subviews.first(where: {
$0.className == "NSTitlebarContainerView"
}) else { return }

for v in titlebarContainer.subviews(withClassName: "NSTitlebarSeparatorView") {
for v in titlebarContainer.descendants(withClassName: "NSTitlebarSeparatorView") {
v.isHidden = true
}
}
Expand Down
6 changes: 3 additions & 3 deletions macos/Sources/Helpers/NSView+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import AppKit

extension NSView {

func subviews(withClassName name: String) -> [NSView] {
/// Recursively finds and returns descendant views that have the given class name.
func descendants(withClassName name: String) -> [NSView] {
var result = [NSView]()

for subview in subviews {
if String(describing: type(of: subview)) == name {
result.append(subview)
}

result += subview.subviews(withClassName: name)
result += subview.descendants(withClassName: name)
}

return result
Expand Down

0 comments on commit 93fb852

Please sign in to comment.