This is a small cleanup change. This provides the Ghostty.AppState
object to any view that needs it within the TerminalSplit view hierarchy
without needing to explicitly define EnvironmentKeys.
This commit does two things: adds a weak reference to the parent
container of each SplitNode.Container and SplitNode.Leaf and moves the
"direction" of a split out of the SplitNode enum and into the
SplitNode.Container struct as a field.
Both changes are required for supporting split resizing. A reference to
the parent in each leaf and split container is needed in order to
traverse upwards through the split tree. If the focused split is not
part of a container that is split along the direction that was requested
to be resized, then we instead try and resize the parent. If the parent
is split along the requested direction, then it is resized
appropriately; otherwise, repeat until the root of the tree is reached.
The direction is needed inside the SplitNode.Container object itself so
that the container knows whether or not it is able to resize itself in
the direction requested by the user. Once the split direction was moved
inside of SplitNode.Container, it became redundant to also have it as
part of the SplitNode enum, so this simplifies things.
Related to #799
With tabbing mode disabled, fullscreen (native) windows when creating a
new tab creates a window in the tab bar, but ALSO puts the window into a
new "screen" on macOS. When you click the tab bar, macOS animates
between screens. Its jarring!
This commit makes it so that in fullscreen we go back to automatic
tabbing even for new windows, which produces new windows within a tab.
This is normal default behavior for macOS tabbed programs. When you are
not in fullscreen or exit fullscreen, then the tabbing mode returns to
disabled so Ghostty can manage it.
The resizeIncrements property is only modified when the cell size of the
focused window changes. If two splits have the same cell size then the
property is not modified when focusing between the two splits.
There is a setting in the macOS System Preferences called "Prefer tabs
when opening documents" (accessed through the userTabbingPreference
field of NSWindow) which, when set to "Always", makes the "New Window"
action open windows in tabs.
Ideally, this setting would be controlled on a per-app basis in macOS,
but unfortunately that is not the case. Because Ghostty explicitly
offers both "New Tab" and "New Window" actions, this user setting should
be ignored when creating new windows.