Add helper functions for finding root

This commit is contained in:
Ryota
2024-01-12 00:52:17 +00:00
parent 28ead2fd30
commit d9c4bd7e25

View File

@ -264,6 +264,13 @@ extension Ghostty {
return weight
}
/// Returns the top most parent, or this container. Because this
/// would fall back to use to self, the return value is guaranteed.
func rootContainer() -> Container {
guard let parent = self.parent else { return self }
return parent.rootContainer()
}
// MARK: - Hashable
func hash(into hasher: inout Hasher) {