diff --git a/.github/swift-file-length-budget.tsv b/.github/swift-file-length-budget.tsv index ea13c6d70701..6f5bd6d82d61 100644 --- a/.github/swift-file-length-budget.tsv +++ b/.github/swift-file-length-budget.tsv @@ -2,40 +2,40 @@ # Format: max_linesrelative path # Reduce counts as files shrink. CI fails if tracked files exceed this budget. 33857 CLI/cmux.swift -17914 Sources/AppDelegate.swift -16740 Sources/ContentView.swift +17932 Sources/AppDelegate.swift +16733 Sources/ContentView.swift 14612 Sources/TerminalController.swift 13595 Sources/Panels/BrowserPanel.swift 12088 Sources/GhosttyTerminalView.swift 12046 cmuxTests/AppDelegateShortcutRoutingTests.swift -11992 Sources/Workspace.swift +12036 Sources/Workspace.swift 9331 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift 7911 Sources/Panels/BrowserPanelView.swift 7350 cmuxTests/WorkspaceUnitTests.swift 6944 cmuxTests/WorkspaceRemoteConnectionTests.swift +6363 cmuxTests/GhosttyConfigTests.swift 6317 cmuxTests/SessionPersistenceTests.swift -6299 cmuxTests/GhosttyConfigTests.swift 6153 CLI/cmux_open.swift -6074 Sources/TabManager.swift +6086 Sources/TabManager.swift 6074 Sources/TextBoxInput.swift 5925 cmuxTests/TerminalAndGhosttyTests.swift 5522 cmuxTests/BrowserConfigTests.swift -4921 Sources/cmuxApp.swift 5113 Packages/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift +4927 Sources/cmuxApp.swift 4460 Sources/Panels/FilePreviewPanel.swift 4400 cmuxTests/BrowserPanelTests.swift 4227 Sources/BrowserWindowPortal.swift 3937 Sources/Feed/FeedPanelView.swift 3903 cmuxTests/WindowAndDragTests.swift -3765 cmuxTests/TabManagerUnitTests.swift +3828 cmuxTests/TabManagerUnitTests.swift 3699 cmuxTests/CLIGenericHookPersistenceTests.swift 3664 Packages/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift 3397 Sources/CmuxConfig.swift 3331 cmuxTests/TabManagerSessionSnapshotTests.swift -3204 Sources/Update/UpdateTitlebarAccessory.swift +3200 Sources/Update/UpdateTitlebarAccessory.swift 2878 Sources/SessionIndexView.swift 2871 cmuxTests/CMUXOpenCommandTests.swift -2573 Sources/KeyboardShortcutSettings.swift +2583 Sources/KeyboardShortcutSettings.swift 2565 Sources/Panels/CmuxWebView.swift 2546 cmuxTests/WorkspaceManualUnreadTests.swift 2449 cmuxTests/CommandPaletteSearchEngineTests.swift @@ -59,11 +59,11 @@ 1652 cmuxTests/CMUXCLIErrorOutputRegressionTests.swift 1574 cmuxTests/MarkdownPanelTests.swift 1560 cmuxTests/TextBoxMentionCompletionTests.swift -1498 cmuxTests/OmnibarAndToolsTests.swift +1497 cmuxTests/OmnibarAndToolsTests.swift 1496 cmuxUITests/MultiWindowNotificationsUITests.swift 1446 Sources/FileExplorerStore.swift -1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift 1382 cmuxTests/KeyboardShortcutSettingsFileStoreStartupTests.swift +1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift 1373 cmuxTests/AppDelegateIssue2907RoutingTests.swift 1366 Sources/Feed/FeedButtonStyleDebugWindowController.swift 1362 Sources/CMUXInstalledExtensionSidebarHostView.swift @@ -92,9 +92,9 @@ 937 Sources/TextBoxMentionIndexStore.swift 934 Sources/App/ShortcutRoutingSupport.swift 926 Sources/DockPanelView.swift +920 Sources/CommandPalette/CommandPaletteSettingsToggle.swift 919 Packages/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+RuntimeLifecycle.swift 918 cmuxTests/WorkspaceGroupTests.swift -920 Sources/CommandPalette/CommandPaletteSettingsToggle.swift 905 Sources/CmuxSSHURLRequest.swift 901 Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AppSection.swift 893 Sources/WorkspaceContentView.swift @@ -117,13 +117,15 @@ 752 cmuxUITests/CloseWorkspaceCmdDUITests.swift 746 Sources/App/MenuBarExtraController.swift 738 Packages/CMUXProjectModel/Sources/CMUXProjectModel/XcodeProjectAdapter.swift -738 Packages/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift +736 Packages/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift +726 cmuxTests/CLICodexHookTimeoutRegressionTests.swift +722 cmuxTests/KeyboardShortcutContextTests.swift 716 Sources/TaskManagerSnapshot.swift 715 Packages/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+Input.swift 715 Sources/AppleScriptSupport.swift 710 Sources/TerminalSSHSessionDetector.swift -706 CLI/CMUXCLI+Config.swift 707 CLI/CMUXCLI+AgentHookDefinitions.swift +706 CLI/CMUXCLI+Config.swift 699 Sources/RightSidebarPanelView.swift 699 cmuxTests/TerminalNotificationClearAllTests.swift 698 cmuxTests/RestorableAgentHookProviderResumeTests.swift @@ -131,7 +133,6 @@ 693 Sources/Panels/BrowserPopupWindowController.swift 691 Sources/NotificationSoundSettings.swift 691 cmuxTests/TaskManagerResourcesTests.swift -688 cmuxTests/KeyboardShortcutContextTests.swift 683 Packages/CmuxSwiftRender/Sources/CmuxSwiftRender/SwiftViewInterpreter.swift 683 Sources/Panels/CodexAppServerSession.swift 681 Sources/Panels/AgentSessionProcessStore.swift @@ -187,7 +188,6 @@ 528 cmuxTests/CLINotifyProcessTestSupport.swift 528 cmuxUITests/AutomationSocketUITests.swift 527 CLI/CLISocketPathResolver.swift -726 cmuxTests/CLICodexHookTimeoutRegressionTests.swift 523 Packages/CmuxRemoteSession/Sources/CmuxRemoteSession/Session/RemoteSessionCoordinator+PortScan.swift 520 CLI/CMUXCLI+AmpExtension.swift 520 cmuxTests/MainWindowVisibilityControllerTests.swift diff --git a/CLAUDE.md b/CLAUDE.md index a920858e22b7..61c6196d98ec 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,17 +38,17 @@ App path: **Claude Code** outputs: ```markdown -======================================================= +------------------------------------------------------- [cmux DEV my-tag.app](file:///Users/someone/Library/Developer/Xcode/DerivedData/cmux-my-tag/Build/Products/Debug/cmux%20DEV%20my-tag.app) -======================================================= +------------------------------------------------------- ``` **Codex** outputs: ```markdown -======================================================= +------------------------------------------------------- [my-tag: file:///Users/someone/Library/Developer/Xcode/DerivedData/cmux-my-tag/Build/Products/Debug/cmux%20DEV%20my-tag.app](file:///Users/someone/Library/Developer/Xcode/DerivedData/cmux-my-tag/Build/Products/Debug/cmux%20DEV%20my-tag.app) -======================================================= +------------------------------------------------------- ``` Never use `/tmp/cmux-/...` app links in chat output. diff --git a/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction+Defaults.swift b/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction+Defaults.swift index 70037d0be683..a8678c275b37 100644 --- a/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction+Defaults.swift +++ b/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction+Defaults.swift @@ -66,6 +66,8 @@ extension ShortcutAction { case .groupSelectedWorkspaces: return ShortcutStroke(key: "g", command: true, shift: true) case .toggleFocusedWorkspaceGroupCollapsed: return ShortcutStroke(key: ".", command: true, control: true) case .reopenClosedBrowserPanel: return ShortcutStroke(key: "t", command: true, shift: true) + case .nextPane: return ShortcutStroke(key: "]", command: true, option: true, control: true) + case .prevPane: return ShortcutStroke(key: "[", command: true, option: true, control: true) case .focusLeft: return ShortcutStroke(key: "←", command: true, option: true) case .focusRight: return ShortcutStroke(key: "→", command: true, option: true) case .focusUp: return ShortcutStroke(key: "↑", command: true, option: true) diff --git a/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift b/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift index 50fa11b58056..758d9404a1d1 100644 --- a/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift +++ b/Packages/CmuxSettings/Sources/CmuxSettings/Values/ShortcutAction.swift @@ -72,6 +72,8 @@ public enum ShortcutAction: String, CaseIterable, Sendable, Hashable, SettingCod case sendCtrlFToTerminal // MARK: Panes + case nextPane + case prevPane case focusLeft case focusRight case focusUp @@ -178,8 +180,9 @@ extension ShortcutAction { .reopenClosedBrowserPanel, .newSurface, .toggleTerminalCopyMode, .focusTextBoxInput, .attachTextBoxFile, .sendCtrlFToTerminal: return .navigation - case .focusLeft, .focusRight, .focusUp, .focusDown, .splitRight, .splitDown, - .toggleSplitZoom, .equalizeSplits, .splitBrowserRight, .splitBrowserDown, + case .nextPane, .prevPane, .focusLeft, .focusRight, .focusUp, .focusDown, + .splitRight, .splitDown, .toggleSplitZoom, .equalizeSplits, + .splitBrowserRight, .splitBrowserDown, .toggleRightSidebar, .toggleCanvasLayout, .canvasRevealFocusedPane, .canvasOverview, .canvasZoomIn, .canvasZoomOut, .canvasZoomReset, .canvasTidy, @@ -345,6 +348,10 @@ extension ShortcutAction { case .attachTextBoxFile: return "Attach File to TextBox Input" case .sendCtrlFToTerminal: return String(localized: "shortcut.sendCtrlFToTerminal.label", defaultValue: "Send Ctrl-F to Terminal") + case .nextPane: + return String(localized: "shortcut.nextPane.label", defaultValue: "Next Pane") + case .prevPane: + return String(localized: "shortcut.previousPane.label", defaultValue: "Previous Pane") case .focusLeft: return "Focus Pane Left" case .focusRight: return "Focus Pane Right" case .focusUp: return "Focus Pane Up" diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 87ec6d72f219..01f1e92b5d80 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -51711,6 +51711,8 @@ } } }, + "command.nextPane.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"التنقل بين اللوحات"}},"bs":{"stringUnit":{"state":"translated","value":"Navigacija panelima"}},"da":{"stringUnit":{"state":"translated","value":"Panelnavigation"}},"de":{"stringUnit":{"state":"translated","value":"Bereichsnavigation"}},"en":{"stringUnit":{"state":"translated","value":"Pane Navigation"}},"es":{"stringUnit":{"state":"translated","value":"Navegación de paneles"}},"fr":{"stringUnit":{"state":"translated","value":"Navigation entre panneaux"}},"it":{"stringUnit":{"state":"translated","value":"Navigazione pannelli"}},"ja":{"stringUnit":{"state":"translated","value":"ペインナビゲーション"}},"km":{"stringUnit":{"state":"translated","value":"ការរុករកផ្ទាំង"}},"ko":{"stringUnit":{"state":"translated","value":"패널 탐색"}},"nb":{"stringUnit":{"state":"translated","value":"Panelnavigering"}},"pl":{"stringUnit":{"state":"translated","value":"Nawigacja po panelach"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Navegação de Painéis"}},"ru":{"stringUnit":{"state":"translated","value":"Навигация по панелям"}},"th":{"stringUnit":{"state":"translated","value":"การนำทางบานหน้าต่าง"}},"tr":{"stringUnit":{"state":"translated","value":"Bölme Gezinmesi"}},"uk":{"stringUnit":{"state":"translated","value":"Навігація панелями"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"面板导航"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"面板導覽"}}}}, + "command.nextPane.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة التالية"}},"bs":{"stringUnit":{"state":"translated","value":"Sljedeći panel"}},"da":{"stringUnit":{"state":"translated","value":"Næste panel"}},"de":{"stringUnit":{"state":"translated","value":"Nächster Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Next Pane"}},"es":{"stringUnit":{"state":"translated","value":"Siguiente panel"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau suivant"}},"it":{"stringUnit":{"state":"translated","value":"Pannello successivo"}},"ja":{"stringUnit":{"state":"translated","value":"次のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងបន្ទាប់"}},"ko":{"stringUnit":{"state":"translated","value":"다음 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Neste panel"}},"pl":{"stringUnit":{"state":"translated","value":"Następny panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Próximo Painel"}},"ru":{"stringUnit":{"state":"translated","value":"Следующая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างถัดไป"}},"tr":{"stringUnit":{"state":"translated","value":"Sonraki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Наступна панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"下一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"下一個面板"}}}}, "command.nextTabInPane.subtitle": { "extractionState": "manual", "localizations": { @@ -53276,6 +53278,8 @@ } } }, + "command.previousPane.subtitle": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"التنقل بين اللوحات"}},"bs":{"stringUnit":{"state":"translated","value":"Navigacija panelima"}},"da":{"stringUnit":{"state":"translated","value":"Panelnavigation"}},"de":{"stringUnit":{"state":"translated","value":"Bereichsnavigation"}},"en":{"stringUnit":{"state":"translated","value":"Pane Navigation"}},"es":{"stringUnit":{"state":"translated","value":"Navegación de paneles"}},"fr":{"stringUnit":{"state":"translated","value":"Navigation entre panneaux"}},"it":{"stringUnit":{"state":"translated","value":"Navigazione pannelli"}},"ja":{"stringUnit":{"state":"translated","value":"ペインナビゲーション"}},"km":{"stringUnit":{"state":"translated","value":"ការរុករកផ្ទាំង"}},"ko":{"stringUnit":{"state":"translated","value":"패널 탐색"}},"nb":{"stringUnit":{"state":"translated","value":"Panelnavigering"}},"pl":{"stringUnit":{"state":"translated","value":"Nawigacja po panelach"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Navegação de Painéis"}},"ru":{"stringUnit":{"state":"translated","value":"Навигация по панелям"}},"th":{"stringUnit":{"state":"translated","value":"การนำทางบานหน้าต่าง"}},"tr":{"stringUnit":{"state":"translated","value":"Bölme Gezinmesi"}},"uk":{"stringUnit":{"state":"translated","value":"Навігація панелями"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"面板导航"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"面板導覽"}}}}, + "command.previousPane.title": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة السابقة"}},"bs":{"stringUnit":{"state":"translated","value":"Prethodni panel"}},"da":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"de":{"stringUnit":{"state":"translated","value":"Vorheriger Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Previous Pane"}},"es":{"stringUnit":{"state":"translated","value":"Panel anterior"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau précédent"}},"it":{"stringUnit":{"state":"translated","value":"Pannello precedente"}},"ja":{"stringUnit":{"state":"translated","value":"前のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងមុន"}},"ko":{"stringUnit":{"state":"translated","value":"이전 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"pl":{"stringUnit":{"state":"translated","value":"Poprzedni panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Painel Anterior"}},"ru":{"stringUnit":{"state":"translated","value":"Предыдущая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างก่อนหน้า"}},"tr":{"stringUnit":{"state":"translated","value":"Önceki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Попередня панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"上一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"上一個面板"}}}}, "command.previousTabInPane.subtitle": { "extractionState": "manual", "localizations": { @@ -83083,6 +83087,7 @@ } } }, + "menu.view.nextPane": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة التالية"}},"bs":{"stringUnit":{"state":"translated","value":"Sljedeći panel"}},"da":{"stringUnit":{"state":"translated","value":"Næste panel"}},"de":{"stringUnit":{"state":"translated","value":"Nächster Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Next Pane"}},"es":{"stringUnit":{"state":"translated","value":"Siguiente panel"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau suivant"}},"it":{"stringUnit":{"state":"translated","value":"Pannello successivo"}},"ja":{"stringUnit":{"state":"translated","value":"次のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងបន្ទាប់"}},"ko":{"stringUnit":{"state":"translated","value":"다음 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Neste panel"}},"pl":{"stringUnit":{"state":"translated","value":"Następny panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Próximo Painel"}},"ru":{"stringUnit":{"state":"translated","value":"Следующая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างถัดไป"}},"tr":{"stringUnit":{"state":"translated","value":"Sonraki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Наступна панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"下一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"下一個面板"}}}}, "menu.view.nextSurface": { "extractionState": "manual", "localizations": { @@ -83321,6 +83326,7 @@ } } }, + "menu.view.previousPane": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة السابقة"}},"bs":{"stringUnit":{"state":"translated","value":"Prethodni panel"}},"da":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"de":{"stringUnit":{"state":"translated","value":"Vorheriger Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Previous Pane"}},"es":{"stringUnit":{"state":"translated","value":"Panel anterior"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau précédent"}},"it":{"stringUnit":{"state":"translated","value":"Pannello precedente"}},"ja":{"stringUnit":{"state":"translated","value":"前のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងមុន"}},"ko":{"stringUnit":{"state":"translated","value":"이전 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"pl":{"stringUnit":{"state":"translated","value":"Poprzedni panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Painel Anterior"}},"ru":{"stringUnit":{"state":"translated","value":"Предыдущая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างก่อนหน้า"}},"tr":{"stringUnit":{"state":"translated","value":"Önceki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Попередня панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"上一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"上一個面板"}}}}, "menu.view.previousSurface": { "extractionState": "manual", "localizations": { @@ -126825,6 +126831,7 @@ } } }, + "shortcut.nextPane.label": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة التالية"}},"bs":{"stringUnit":{"state":"translated","value":"Sljedeći panel"}},"da":{"stringUnit":{"state":"translated","value":"Næste panel"}},"de":{"stringUnit":{"state":"translated","value":"Nächster Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Next Pane"}},"es":{"stringUnit":{"state":"translated","value":"Siguiente panel"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau suivant"}},"it":{"stringUnit":{"state":"translated","value":"Pannello successivo"}},"ja":{"stringUnit":{"state":"translated","value":"次のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងបន្ទាប់"}},"ko":{"stringUnit":{"state":"translated","value":"다음 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Neste panel"}},"pl":{"stringUnit":{"state":"translated","value":"Następny panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Próximo Painel"}},"ru":{"stringUnit":{"state":"translated","value":"Следующая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างถัดไป"}},"tr":{"stringUnit":{"state":"translated","value":"Sonraki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Наступна панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"下一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"下一個面板"}}}}, "shortcut.nextSurface.label": { "extractionState": "manual", "localizations": { @@ -129368,6 +129375,7 @@ } } }, + "shortcut.previousPane.label": {"extractionState":"manual","localizations":{"ar":{"stringUnit":{"state":"translated","value":"اللوحة السابقة"}},"bs":{"stringUnit":{"state":"translated","value":"Prethodni panel"}},"da":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"de":{"stringUnit":{"state":"translated","value":"Vorheriger Bereich"}},"en":{"stringUnit":{"state":"translated","value":"Previous Pane"}},"es":{"stringUnit":{"state":"translated","value":"Panel anterior"}},"fr":{"stringUnit":{"state":"translated","value":"Panneau précédent"}},"it":{"stringUnit":{"state":"translated","value":"Pannello precedente"}},"ja":{"stringUnit":{"state":"translated","value":"前のペイン"}},"km":{"stringUnit":{"state":"translated","value":"ផ្ទាំងមុន"}},"ko":{"stringUnit":{"state":"translated","value":"이전 패널"}},"nb":{"stringUnit":{"state":"translated","value":"Forrige panel"}},"pl":{"stringUnit":{"state":"translated","value":"Poprzedni panel"}},"pt-BR":{"stringUnit":{"state":"translated","value":"Painel Anterior"}},"ru":{"stringUnit":{"state":"translated","value":"Предыдущая панель"}},"th":{"stringUnit":{"state":"translated","value":"บานหน้าต่างก่อนหน้า"}},"tr":{"stringUnit":{"state":"translated","value":"Önceki Bölme"}},"uk":{"stringUnit":{"state":"translated","value":"Попередня панель"}},"zh-Hans":{"stringUnit":{"state":"translated","value":"上一个面板"}},"zh-Hant":{"stringUnit":{"state":"translated","value":"上一個面板"}}}}, "shortcut.previousSurface.label": { "extractionState": "manual", "localizations": { diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index fb378e8ccf68..94de47c4c555 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -13090,6 +13090,24 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent return true } + // Pane cycling: focus the next/previous split pane in stable split-tree order. + if matchConfiguredShortcut(event: event, action: .nextPane) { + let targetContext = preferredMainWindowContextForShortcutRouting(event: event) + let targetManager = targetContext?.tabManager ?? tabManager + let targetWindow = targetContext.flatMap { $0.window ?? windowForMainWindowId($0.windowId) } ?? NSApp.keyWindow + cmuxRememberFindSelectionBeforePanelFocusMove(tabManager: targetManager, window: targetWindow) + _ = targetManager?.focusNextPane() + return true + } + if matchConfiguredShortcut(event: event, action: .prevPane) { + let targetContext = preferredMainWindowContextForShortcutRouting(event: event) + let targetManager = targetContext?.tabManager ?? tabManager + let targetWindow = targetContext.flatMap { $0.window ?? windowForMainWindowId($0.windowId) } ?? NSApp.keyWindow + cmuxRememberFindSelectionBeforePanelFocusMove(tabManager: targetManager, window: targetWindow) + _ = targetManager?.focusPreviousPane() + return true + } + // Surface navigation: Cmd+Shift+] / Cmd+Shift+[ if matchConfiguredShortcut(event: event, action: .nextSurface) { tabManager?.selectNextSurface() diff --git a/Sources/ContentView+RightSidebarCommandPalette.swift b/Sources/ContentView+RightSidebarCommandPalette.swift index d8539c87e3d4..a69d91261e51 100644 --- a/Sources/ContentView+RightSidebarCommandPalette.swift +++ b/Sources/ContentView+RightSidebarCommandPalette.swift @@ -50,6 +50,10 @@ extension ContentView { return .nextSurface case "palette.previousTabInPane": return .prevSurface + case "palette.nextPane": + return .nextPane + case "palette.previousPane": + return .prevPane case "palette.browserToggleDevTools": return .toggleBrowserDeveloperTools case "palette.browserConsole": diff --git a/Sources/ContentView.swift b/Sources/ContentView.swift index f26e1c086307..0429a8d9d196 100644 --- a/Sources/ContentView.swift +++ b/Sources/ContentView.swift @@ -7057,6 +7057,24 @@ struct ContentView: View { when: { $0.bool(CommandPaletteContextKeys.hasFocusedPanel) } ) ) + contributions.append( + CommandPaletteCommandContribution( + commandId: "palette.nextPane", + title: constant(String(localized: "command.nextPane.title", defaultValue: "Next Pane")), + subtitle: constant(String(localized: "command.nextPane.subtitle", defaultValue: "Pane Navigation")), + keywords: ["next", "pane", "split", "focus"], + when: { $0.bool(CommandPaletteContextKeys.hasFocusedPanel) } + ) + ) + contributions.append( + CommandPaletteCommandContribution( + commandId: "palette.previousPane", + title: constant(String(localized: "command.previousPane.title", defaultValue: "Previous Pane")), + subtitle: constant(String(localized: "command.previousPane.subtitle", defaultValue: "Pane Navigation")), + keywords: ["previous", "pane", "split", "focus"], + when: { $0.bool(CommandPaletteContextKeys.hasFocusedPanel) } + ) + ) contributions.append( CommandPaletteCommandContribution( @@ -8017,6 +8035,12 @@ struct ContentView: View { registry.register(commandId: "palette.previousTabInPane") { tabManager.selectPreviousSurface() } + registry.register(commandId: "palette.nextPane") { + _ = tabManager.focusNextPane() + } + registry.register(commandId: "palette.previousPane") { + _ = tabManager.focusPreviousPane() + } registry.register(commandId: "palette.openWorkspacePullRequests") { DispatchQueue.main.async { if !openWorkspacePullRequestsInConfiguredBrowser() { diff --git a/Sources/KeyboardShortcutSettings.swift b/Sources/KeyboardShortcutSettings.swift index 8f4756b7337b..6582869afed1 100644 --- a/Sources/KeyboardShortcutSettings.swift +++ b/Sources/KeyboardShortcutSettings.swift @@ -118,6 +118,8 @@ enum KeyboardShortcutSettings { case sendCtrlFToTerminal // Panes / splits + case nextPane + case prevPane case focusLeft case focusRight case focusUp @@ -233,6 +235,8 @@ enum KeyboardShortcutSettings { case .toggleTerminalCopyMode: return String(localized: "shortcut.toggleTerminalCopyMode.label", defaultValue: "Toggle Terminal Copy Mode") case .focusTextBoxInput: return String(localized: "shortcut.focusTextBoxInput.label", defaultValue: "Focus TextBox Input") case .attachTextBoxFile: return String(localized: "shortcut.attachTextBoxFile.label", defaultValue: "Attach File to TextBox Input") + case .nextPane: return String(localized: "shortcut.nextPane.label", defaultValue: "Next Pane") + case .prevPane: return String(localized: "shortcut.previousPane.label", defaultValue: "Previous Pane") case .sendCtrlFToTerminal: return String(localized: "shortcut.sendCtrlFToTerminal.label", defaultValue: "Send Ctrl-F to Terminal") case .focusLeft: return String(localized: "shortcut.focusPaneLeft.label", defaultValue: "Focus Pane Left") case .focusRight: return String(localized: "shortcut.focusPaneRight.label", defaultValue: "Focus Pane Right") @@ -465,6 +469,10 @@ enum KeyboardShortcutSettings { return StoredShortcut(key: "a", command: true, shift: true, option: false, control: false) case .attachTextBoxFile: return StoredShortcut(key: "a", command: true, shift: true, option: true, control: false) + case .nextPane: + return StoredShortcut(key: "]", command: true, shift: false, option: true, control: true) + case .prevPane: + return StoredShortcut(key: "[", command: true, shift: false, option: true, control: true) case .sendCtrlFToTerminal: // Unbound by default: this is a deliberate escape hatch for forwarding a // control chord (e.g. Claude Code's Ctrl-F force-stop) to the focused @@ -1064,6 +1072,8 @@ enum KeyboardShortcutSettings { static func focusRightShortcut() -> StoredShortcut { shortcut(for: .focusRight) } static func focusUpShortcut() -> StoredShortcut { shortcut(for: .focusUp) } static func focusDownShortcut() -> StoredShortcut { shortcut(for: .focusDown) } + static func nextPaneShortcut() -> StoredShortcut { shortcut(for: .nextPane) } + static func prevPaneShortcut() -> StoredShortcut { shortcut(for: .prevPane) } static func splitRightShortcut() -> StoredShortcut { shortcut(for: .splitRight) } static func splitDownShortcut() -> StoredShortcut { shortcut(for: .splitDown) } diff --git a/Sources/TabManager.swift b/Sources/TabManager.swift index f8b7fb1ece0f..eb16782ba08a 100644 --- a/Sources/TabManager.swift +++ b/Sources/TabManager.swift @@ -3638,6 +3638,18 @@ class TabManager: ObservableObject { tab.moveFocus(direction: direction) } + /// Move focus to the next pane in split-tree order. + @discardableResult + func focusNextPane() -> Bool { + selectedWorkspace?.focusNextPane() ?? false + } + + /// Move focus to the previous pane in split-tree order. + @discardableResult + func focusPreviousPane() -> Bool { + selectedWorkspace?.focusPreviousPane() ?? false + } + // MARK: - Focus History Navigation (CmuxWorkspaceNavigation) // The back/forward stack, suppression depth, and navigation logic live diff --git a/Sources/Workspace.swift b/Sources/Workspace.swift index e6ed9385ddba..3621873a1b0a 100644 --- a/Sources/Workspace.swift +++ b/Sources/Workspace.swift @@ -8876,6 +8876,50 @@ final class Workspace: Identifiable, ObservableObject { } + @discardableResult + func focusNextPane() -> Bool { + focusPane(offset: 1) + } + + @discardableResult + func focusPreviousPane() -> Bool { + focusPane(offset: -1) + } + + @discardableResult + private func focusPane(offset: Int) -> Bool { + if let zoomedPaneId = bonsplitController.zoomedPaneId { + guard bonsplitController.allPaneIds.contains(zoomedPaneId) else { return false } + guard bonsplitController.focusedPaneId != zoomedPaneId else { return false } + return focusSelectedPanel(inPane: zoomedPaneId) + } + + let paneIds = bonsplitController.allPaneIds + guard paneIds.count > 1 else { return false } + + guard let currentPaneId = bonsplitController.focusedPaneId, + let currentIndex = paneIds.firstIndex(of: currentPaneId) else { + return false + } + + let targetIndex = (currentIndex + offset + paneIds.count) % paneIds.count + let targetPaneId = paneIds[targetIndex] + return focusSelectedPanel(inPane: targetPaneId) + } + + @discardableResult + private func focusSelectedPanel(inPane paneId: PaneID) -> Bool { + let targetTab = bonsplitController.selectedTab(inPane: paneId) + ?? bonsplitController.tabs(inPane: paneId).first + guard let targetTab, + let targetPanelId = panelIdFromSurfaceId(targetTab.id) else { + return false + } + + focusPanel(targetPanelId) + return true + } + // MARK: - Surface Navigation /// Select the next surface in the currently focused pane diff --git a/Sources/cmuxApp.swift b/Sources/cmuxApp.swift index 83ac0c72eaf2..f7becdf80c43 100644 --- a/Sources/cmuxApp.swift +++ b/Sources/cmuxApp.swift @@ -912,6 +912,12 @@ struct cmuxApp: App { } } Divider() + splitCommandButton(title: String(localized: "menu.view.nextPane", defaultValue: "Next Pane"), shortcut: menuShortcut(for: .nextPane)) { + _ = activeTabManager.focusNextPane() + } + splitCommandButton(title: String(localized: "menu.view.previousPane", defaultValue: "Previous Pane"), shortcut: menuShortcut(for: .prevPane)) { + _ = activeTabManager.focusPreviousPane() + } splitCommandButton(title: String(localized: "menu.view.nextSurface", defaultValue: "Next Surface"), shortcut: menuShortcut(for: .nextSurface)) { activeTabManager.selectNextSurface() } diff --git a/cmuxTests/KeyboardShortcutContextTests.swift b/cmuxTests/KeyboardShortcutContextTests.swift index 042b3610b484..4efb570a2933 100644 --- a/cmuxTests/KeyboardShortcutContextTests.swift +++ b/cmuxTests/KeyboardShortcutContextTests.swift @@ -152,6 +152,40 @@ final class KeyboardShortcutContextTests: XCTestCase { XCTAssertEqual(KeyboardShortcutSettings.Action.toggleReactGrab.shortcutContext, .application) } + func testPaneCycleShortcutsArePublicConfigurableActions() { + XCTAssertTrue(KeyboardShortcutSettings.publicShortcutActions.contains(.nextPane)) + XCTAssertTrue(KeyboardShortcutSettings.publicShortcutActions.contains(.prevPane)) + XCTAssertEqual( + KeyboardShortcutSettings.Action.nextPane.defaultShortcut, + StoredShortcut(key: "]", command: true, shift: false, option: true, control: true) + ) + XCTAssertEqual( + KeyboardShortcutSettings.Action.prevPane.defaultShortcut, + StoredShortcut(key: "[", command: true, shift: false, option: true, control: true) + ) + XCTAssertEqual( + ShortcutAction.nextPane.defaultStroke, + ShortcutStroke(key: "]", command: true, option: true, control: true) + ) + XCTAssertEqual( + ShortcutAction.prevPane.defaultStroke, + ShortcutStroke(key: "[", command: true, option: true, control: true) + ) + XCTAssertEqual(ShortcutAction.nextPane.displayName, KeyboardShortcutSettings.Action.nextPane.label) + XCTAssertEqual(ShortcutAction.prevPane.displayName, KeyboardShortcutSettings.Action.prevPane.label) + } + + func testPublicShortcutActionsHaveSettingsPackageCounterparts() { + let missingActions = KeyboardShortcutSettings.publicShortcutActions + .filter { ShortcutAction(rawValue: $0.rawValue) == nil } + .map(\.rawValue) + + XCTAssertTrue( + missingActions.isEmpty, + "Missing CmuxSettings.ShortcutAction cases: \(missingActions.joined(separator: ", "))" + ) + } + func testBrowserFocusModeToggleIsBrowserScopedAndDoesNotCollideWithSplitZoom() { let focusMode = KeyboardShortcutSettings.Action.toggleBrowserFocusMode diff --git a/cmuxTests/TabManagerUnitTests.swift b/cmuxTests/TabManagerUnitTests.swift index 78d8f9e260b4..151a744ac78b 100644 --- a/cmuxTests/TabManagerUnitTests.swift +++ b/cmuxTests/TabManagerUnitTests.swift @@ -2205,6 +2205,69 @@ final class TabManagerPendingUnfocusPolicyTests: XCTestCase { } +@MainActor +final class TabManagerPaneFocusCycleTests: XCTestCase { + func testFocusNextPaneCyclesThroughSplitTreeOrder() throws { + let manager = TabManager() + let workspace = try XCTUnwrap(manager.selectedWorkspace) + let leftPanelId = try XCTUnwrap(workspace.focusedPanelId) + let rightPanel = try XCTUnwrap( + workspace.newTerminalSplit(from: leftPanelId, orientation: .horizontal, focus: false) + ) + + workspace.focusPanel(leftPanelId) + + XCTAssertTrue(manager.focusNextPane()) + XCTAssertEqual(workspace.focusedPanelId, rightPanel.id) + + XCTAssertTrue(manager.focusNextPane()) + XCTAssertEqual(workspace.focusedPanelId, leftPanelId) + } + + func testFocusPreviousPaneWrapsToLastPane() throws { + let manager = TabManager() + let workspace = try XCTUnwrap(manager.selectedWorkspace) + let firstPanelId = try XCTUnwrap(workspace.focusedPanelId) + let lastPanel = try XCTUnwrap( + workspace.newTerminalSplit(from: firstPanelId, orientation: .horizontal, focus: false) + ) + + workspace.focusPanel(firstPanelId) + + XCTAssertTrue(manager.focusPreviousPane()) + XCTAssertEqual(workspace.focusedPanelId, lastPanel.id) + } + + func testFocusNextPaneReturnsFalseForSinglePaneWorkspace() throws { + let manager = TabManager() + let workspace = try XCTUnwrap(manager.selectedWorkspace) + let originalFocusedPanelId = workspace.focusedPanelId + + XCTAssertFalse(manager.focusNextPane()) + XCTAssertEqual(workspace.focusedPanelId, originalFocusedPanelId) + } + + func testFocusPaneCycleDoesNotLeaveZoomedPane() throws { + let manager = TabManager() + let workspace = try XCTUnwrap(manager.selectedWorkspace) + let leftPanelId = try XCTUnwrap(workspace.focusedPanelId) + let rightPanel = try XCTUnwrap( + workspace.newTerminalSplit(from: leftPanelId, orientation: .horizontal, focus: false) + ) + + workspace.focusPanel(leftPanelId) + XCTAssertTrue(workspace.toggleSplitZoom(panelId: leftPanelId)) + + XCTAssertFalse(manager.focusNextPane()) + XCTAssertEqual(workspace.focusedPanelId, leftPanelId) + XCTAssertNotEqual(workspace.focusedPanelId, rightPanel.id) + + XCTAssertFalse(manager.focusPreviousPane()) + XCTAssertEqual(workspace.focusedPanelId, leftPanelId) + XCTAssertNotEqual(workspace.focusedPanelId, rightPanel.id) + } +} + @MainActor final class TabManagerSurfaceCreationTests: XCTestCase { func testFocusTextBoxOnNewTerminalsDefaultAppliesToNewWorkspaceAndTerminalSurfaces() { diff --git a/web/app/[locale]/docs/configuration/page.tsx b/web/app/[locale]/docs/configuration/page.tsx index 1a125ef68559..bac903910074 100644 --- a/web/app/[locale]/docs/configuration/page.tsx +++ b/web/app/[locale]/docs/configuration/page.tsx @@ -147,7 +147,7 @@ export async function generateMetadata({ params }: { params: Promise<{ locale: s } function localizedText(text: LocalizedText, locale: string) { - return locale.startsWith("ja") ? text.ja : text.en; + return text[locale] ?? (locale.startsWith("ja") ? text.ja : text.en); } function shortcutToConfig(shortcut: { combos: string[][]; configValue?: string }) { diff --git a/web/app/[locale]/keyboard-shortcuts.tsx b/web/app/[locale]/keyboard-shortcuts.tsx index 6072d4e037f7..09eacfbae811 100644 --- a/web/app/[locale]/keyboard-shortcuts.tsx +++ b/web/app/[locale]/keyboard-shortcuts.tsx @@ -5,7 +5,7 @@ import { useLocale, useTranslations } from "next-intl"; import { shortcutCategories, type LocalizedText, type Shortcut } from "../../data/cmux-shortcuts"; function localizedText(text: LocalizedText, locale: string) { - return locale.startsWith("ja") ? text.ja : text.en; + return text[locale] ?? (locale.startsWith("ja") ? text.ja : text.en); } function normalize(s: string) { diff --git a/web/data/cmux-shortcuts.ts b/web/data/cmux-shortcuts.ts index 2d00ad0a9c40..d01e6f58e254 100644 --- a/web/data/cmux-shortcuts.ts +++ b/web/data/cmux-shortcuts.ts @@ -1,6 +1,7 @@ export type LocalizedText = { en: string; ja: string; + [locale: string]: string; }; export type Shortcut = { @@ -165,6 +166,58 @@ export const shortcutCategories: ShortcutCategory[] = [ id: "split-panes", titleKey: "splitPanes", shortcuts: [ + { + id: "nextPane", + combos: [["⌃", "⌥", "⌘", "]"]], + description: { + ar: "اللوحة التالية", + bs: "Sljedeći panel", + da: "Næste panel", + de: "Nächster Bereich", + en: "Next pane", + es: "Siguiente panel", + fr: "Panneau suivant", + it: "Pannello successivo", + ja: "次のペイン", + km: "ផ្ទាំងបន្ទាប់", + ko: "다음 패널", + no: "Neste panel", + pl: "Następny panel", + "pt-BR": "Próximo painel", + ru: "Следующая панель", + th: "บานหน้าต่างถัดไป", + tr: "Sonraki bölme", + uk: "Наступна панель", + "zh-CN": "下一个面板", + "zh-TW": "下一個面板", + }, + }, + { + id: "prevPane", + combos: [["⌃", "⌥", "⌘", "["]], + description: { + ar: "اللوحة السابقة", + bs: "Prethodni panel", + da: "Forrige panel", + de: "Vorheriger Bereich", + en: "Previous pane", + es: "Panel anterior", + fr: "Panneau précédent", + it: "Pannello precedente", + ja: "前のペイン", + km: "ផ្ទាំងមុន", + ko: "이전 패널", + no: "Forrige panel", + pl: "Poprzedni panel", + "pt-BR": "Painel anterior", + ru: "Предыдущая панель", + th: "บานหน้าต่างก่อนหน้า", + tr: "Önceki bölme", + uk: "Попередня панель", + "zh-CN": "上一个面板", + "zh-TW": "上一個面板", + }, + }, { id: "focusLeft", combos: [["⌥", "⌘", "←"]], description: { en: "Focus pane left", ja: "左のペインにフォーカス" } }, { id: "focusRight", combos: [["⌥", "⌘", "→"]], description: { en: "Focus pane right", ja: "右のペインにフォーカス" } }, { id: "focusUp", combos: [["⌥", "⌘", "↑"]], description: { en: "Focus pane up", ja: "上のペインにフォーカス" } }, diff --git a/web/data/cmux.schema.json b/web/data/cmux.schema.json index b47aed27cd03..c1dffecae285 100644 --- a/web/data/cmux.schema.json +++ b/web/data/cmux.schema.json @@ -1192,6 +1192,8 @@ "toggleTerminalCopyMode", "focusTextBoxInput", "attachTextBoxFile", + "nextPane", + "prevPane", "sendCtrlFToTerminal", "focusLeft", "focusRight",