mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: rename indexTabs() to relabelTabs()
This is a better name because the tab label may not necessarily be an index (if a user binds some non-numeric key, for instance).
This commit is contained in:

committed by
Mitchell Hashimoto

parent
59ba6fac2b
commit
8f75e83958
@ -23,10 +23,13 @@ class PrimaryWindowController: NSWindowController, NSWindowDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func windowDidBecomeKey(_ notification: Notification) {
|
func windowDidBecomeKey(_ notification: Notification) {
|
||||||
self.windowManager?.indexTabs()
|
self.windowManager?.relabelTabs()
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowWillClose(_ notification: Notification) {
|
func windowWillClose(_ notification: Notification) {
|
||||||
self.windowManager?.indexTabs()
|
// Tabs must be relabeled when a window is closed because this event
|
||||||
|
// does not fire the "windowDidBecomeKey" event on the newly focused
|
||||||
|
// window
|
||||||
|
self.windowManager?.relabelTabs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,9 +180,10 @@ class PrimaryWindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the accessory view of the first 9 tabs. This is called when the
|
/// Update the accessory view of each tab according to the keyboard
|
||||||
/// key window changes and when a window is closed.
|
/// shortcut that activates it (if any). This is called when the key window
|
||||||
func indexTabs() {
|
/// changes and when a window is closed.
|
||||||
|
func relabelTabs() {
|
||||||
if let windows = self.mainWindow?.tabbedWindows {
|
if let windows = self.mainWindow?.tabbedWindows {
|
||||||
for (index, window) in windows.enumerated().prefix(9) {
|
for (index, window) in windows.enumerated().prefix(9) {
|
||||||
let string = " ⌘\(index + 1) "
|
let string = " ⌘\(index + 1) "
|
||||||
|
Reference in New Issue
Block a user