Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 219 additions & 39 deletions Resources/Localizable.xcstrings

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Sources/CommandPalette/CommandPaletteSettingsToggle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ enum CommandPaletteSettingsToggleCommands {
title: {
String(
localized: "settings.app.commandPaletteSearchAllSurfaces",
defaultValue: "Command Palette Searches All Surfaces"
defaultValue: "Command Palette Searches Tabs"
)
},
sectionTitle: app,
keywords: ["app.commandPaletteSearchesAllSurfaces", "command", "palette", "search", "surfaces", "workspace"],
keywords: ["app.commandPaletteSearchesAllSurfaces", "command", "palette", "search", "tabs", "tab", "titles", "workspace"],
defaultValue: CommandPaletteSwitcherSearchSettings.defaultSearchAllSurfaces,
defaultsKey: CommandPaletteSwitcherSearchSettings.searchAllSurfacesKey
),
Expand Down
4 changes: 2 additions & 2 deletions Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4941,7 +4941,7 @@ struct ContentView: View {
return String(localized: "commandPalette.search.commandsPlaceholder", defaultValue: "Type a command")
case .switcher:
return commandPaletteSearchAllSurfaces
? String(localized: "commandPalette.search.switcherPlaceholderAllSurfaces", defaultValue: "Search workspaces and surfaces")
? String(localized: "commandPalette.search.switcherPlaceholderAllSurfaces", defaultValue: "Search workspaces and tabs")
: String(localized: "commandPalette.search.switcherPlaceholder", defaultValue: "Search workspaces")
}
}
Expand All @@ -4952,7 +4952,7 @@ struct ContentView: View {
return String(localized: "commandPalette.search.commandsEmpty", defaultValue: "No commands match your search.")
case .switcher:
return commandPaletteSearchAllSurfaces
? String(localized: "commandPalette.search.switcherEmptyAllSurfaces", defaultValue: "No workspaces or surfaces match your search.")
? String(localized: "commandPalette.search.switcherEmptyAllSurfaces", defaultValue: "No workspaces or tabs match your search.")
: String(localized: "commandPalette.search.switcherEmpty", defaultValue: "No workspaces match your search.")
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/KeyboardShortcutSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ enum KeyboardShortcutSettings {
case .newTab: return String(localized: "shortcut.newWorkspace.label", defaultValue: "New Workspace")
case .openFolder: return String(localized: "shortcut.openFolder.label", defaultValue: "Open Folder")
case .reopenPreviousSession: return String(localized: "shortcut.reopenPreviousSession.label", defaultValue: "Reopen Previous Session")
case .goToWorkspace: return String(localized: "menu.file.goToWorkspace", defaultValue: "Go to Workspace…")
case .goToWorkspace: return String(localized: "menu.file.goToWorkspace", defaultValue: "Go to Workspace or Tab…")
case .commandPalette: return String(localized: "menu.file.commandPalette", defaultValue: "Command Palette…")
case .commandPaletteNext: return String(localized: "shortcut.commandPaletteNext.label", defaultValue: "Command Palette: Next")
case .commandPalettePrevious: return String(localized: "shortcut.commandPalettePrevious.label", defaultValue: "Command Palette: Previous")
Expand Down
2 changes: 1 addition & 1 deletion Sources/SettingsNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ enum SettingsSearchIndex {
setting(.app, "warn-before-quit", String(localized: "settings.app.warnBeforeQuit", defaultValue: "Warn Before Quit"), "cmd q confirmation"),
setting(.app, "warn-before-closing-tab", String(localized: "settings.app.warnBeforeClosingTab", defaultValue: "Warn Before Closing Tab"), "cmd w close tab confirmation"),
setting(.app, "rename-selects-name", String(localized: "settings.app.renameSelectsName", defaultValue: "Rename Selects Existing Name"), "command palette rename text selection"),
setting(.app, "palette-search-all", String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches All Surfaces"), "cmd p search terminal browser markdown"),
setting(.app, "palette-search-all", String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches Tabs"), "cmd p search tab title terminal browser markdown"),
setting(.terminal, "scrollbar", String(localized: "settings.terminal.scrollBar", defaultValue: "Show Terminal Scroll Bar"), "terminal shell scrollback"),
setting(.terminal, "agent-auto-resume", String(localized: "settings.terminal.agentAutoResume", defaultValue: "Resume Agent Sessions on Reopen"), "terminal.autoResumeAgentSessions auto resume restore reopen relaunch quit sessions agents claude code codex opencode rovo dev rovodev toggle"),
setting(.sidebarAppearance, "match-terminal", String(localized: "settings.sidebarAppearance.matchTerminalBackground", defaultValue: "Match Terminal Background"), "sidebar material transparency"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/SettingsSearchAliases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ enum SettingsSearchAliasIndex {
"app:warn-before-quit": localized("settings.search.alias.setting.app.warn-before-quit", defaultValue: "app.warnBeforeQuit quit confirmation command-q cmd-q exit close app"),
"app:warn-before-closing-tab": localized("settings.search.alias.setting.app.warn-before-closing-tab", defaultValue: "app.warnBeforeClosingTab close tab confirmation command-w cmd-w terminal surface"),
"app:rename-selects-name": localized("settings.search.alias.setting.app.rename-selects-name", defaultValue: "app.renameSelectsExistingName rename select all existing title command palette workspace name"),
"app:palette-search-all": localized("settings.search.alias.setting.app.palette-search-all", defaultValue: "app.commandPaletteSearchesAllSurfaces command palette search all surfaces cmd-p terminal browser markdown"),
"app:palette-search-all": localized("settings.search.alias.setting.app.palette-search-all", defaultValue: "app.commandPaletteSearchesAllSurfaces command palette search tabs tab titles cmd-p terminal browser markdown"),
"terminal:scrollbar": localized("settings.search.alias.setting.terminal.scrollbar", defaultValue: "terminal.showScrollBar scrollback scrollbar scroll bar right edge alternate screen tui"),
"sidebarAppearance:match-terminal": localized("settings.search.alias.setting.sidebarAppearance.match-terminal", defaultValue: "sidebarAppearance.matchTerminalBackground transparent background material terminal background sync"),
"sidebarAppearance:hide-sidebar-details": localized("settings.search.alias.setting.app.hide-sidebar-details", defaultValue: "sidebar.hideAllDetails compact sidebar hide details only title minimal left rail"),
Expand Down
10 changes: 5 additions & 5 deletions Sources/cmuxApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ struct cmuxApp: App {

// Close tab/workspace
CommandGroup(after: .newItem) {
splitCommandButton(title: String(localized: "menu.file.goToWorkspace", defaultValue: "Go to Workspace…"), shortcut: menuShortcut(for: .goToWorkspace)) {
splitCommandButton(title: String(localized: "menu.file.goToWorkspace", defaultValue: "Go to Workspace or Tab…"), shortcut: menuShortcut(for: .goToWorkspace)) {
let targetWindow = NSApp.keyWindow ?? NSApp.mainWindow
NotificationCenter.default.post(name: .commandPaletteSwitcherRequested, object: targetWindow)
}
Expand Down Expand Up @@ -4637,7 +4637,7 @@ enum CommandPaletteRenameSelectionSettings {

enum CommandPaletteSwitcherSearchSettings {
static let searchAllSurfacesKey = "commandPalette.switcherSearchAllSurfaces"
static let defaultSearchAllSurfaces = false
static let defaultSearchAllSurfaces = true
Comment thread
cursor[bot] marked this conversation as resolved.

static func searchAllSurfacesEnabled(defaults: UserDefaults = .standard) -> Bool {
if defaults.object(forKey: searchAllSurfacesKey) == nil {
Expand Down Expand Up @@ -6189,17 +6189,17 @@ struct SettingsView: View {

SettingsCardRow(
configurationReview: .json("app.commandPaletteSearchesAllSurfaces"),
String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches All Surfaces"),
String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches Tabs"),
Comment thread
cursor[bot] marked this conversation as resolved.
subtitle: commandPaletteSearchAllSurfaces
? String(localized: "settings.app.commandPaletteSearchAllSurfaces.subtitleOn", defaultValue: "Cmd+P also matches panel surfaces across workspaces.")
? String(localized: "settings.app.commandPaletteSearchAllSurfaces.subtitleOn", defaultValue: "Cmd+P also matches tab titles across workspaces.")
: String(localized: "settings.app.commandPaletteSearchAllSurfaces.subtitleOff", defaultValue: "Cmd+P matches workspace rows only.")
) {
Toggle("", isOn: $commandPaletteSearchAllSurfaces)
.labelsHidden()
.controlSize(.small)
.accessibilityIdentifier("CommandPaletteSearchAllSurfacesToggle")
.accessibilityLabel(
String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches All Surfaces")
String(localized: "settings.app.commandPaletteSearchAllSurfaces", defaultValue: "Command Palette Searches Tabs")
)
}

Expand Down
90 changes: 90 additions & 0 deletions cmuxTests/CommandPaletteSearchEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,96 @@ final class CommandPaletteSearchEngineTests: XCTestCase {
XCTAssertFalse(workspaceOnlyInputs.includesSurfaces)
}

func testDefaultSwitcherSearchIncludesSurfacesForTabTitleQueries() {
let suiteName = "CommandPaletteSearchEngineTests.\(UUID().uuidString)"
guard let defaults = UserDefaults(suiteName: suiteName) else {
XCTFail("Expected isolated UserDefaults suite")
return
}
defaults.removeObject(forKey: CommandPaletteSwitcherSearchSettings.searchAllSurfacesKey)
defer { defaults.removePersistentDomain(forName: suiteName) }

XCTAssertTrue(CommandPaletteSwitcherSearchSettings.searchAllSurfacesEnabled(defaults: defaults))

let inputs = ContentView.commandPaletteRefreshInputsForTests(
stateQuery: "",
observedQuery: "server logs",
searchAllSurfaces: CommandPaletteSwitcherSearchSettings.searchAllSurfacesEnabled(defaults: defaults)
)
XCTAssertEqual(inputs.scope, "switcher")
XCTAssertEqual(inputs.matchingQuery, "server logs")
XCTAssertTrue(inputs.includesSurfaces)
}

func testExplicitSwitcherSearchOptOutKeepsWorkspaceOnlyQueries() {
let suiteName = "CommandPaletteSearchEngineTests.\(UUID().uuidString)"
guard let defaults = UserDefaults(suiteName: suiteName) else {
XCTFail("Expected isolated UserDefaults suite")
return
}
defaults.set(false, forKey: CommandPaletteSwitcherSearchSettings.searchAllSurfacesKey)
defer { defaults.removePersistentDomain(forName: suiteName) }

XCTAssertFalse(CommandPaletteSwitcherSearchSettings.searchAllSurfacesEnabled(defaults: defaults))

let inputs = ContentView.commandPaletteRefreshInputsForTests(
stateQuery: "",
observedQuery: "server logs",
searchAllSurfaces: CommandPaletteSwitcherSearchSettings.searchAllSurfacesEnabled(defaults: defaults)
)
XCTAssertEqual(inputs.scope, "switcher")
XCTAssertEqual(inputs.matchingQuery, "server logs")
XCTAssertFalse(inputs.includesSurfaces)
}

func testSwitcherTabTitleQueryFindsTabEntry() throws {
let entries = [
FixtureEntry(
id: "switcher.workspace.production",
rank: 0,
title: "Production",
searchableTexts: ["Production", "Workspace", "workspace", "switch", "go", "open"]
),
FixtureEntry(
id: "switcher.surface.server-logs",
rank: 1,
title: "Server Logs",
searchableTexts: [
"Server Logs",
"Production",
"Terminal",
"surface",
"tab",
"switch",
"go",
"open"
]
),
FixtureEntry(
id: "switcher.surface.build-queue",
rank: 2,
title: "Build Queue",
searchableTexts: [
"Build Queue",
"Production",
"Terminal",
"surface",
"tab",
"switch",
"go",
"open"
]
),
]

let results = optimizedResults(entries: entries, query: "server logs")

let first = try XCTUnwrap(results.first)
XCTAssertEqual(first.id, "switcher.surface.server-logs")
XCTAssertEqual(first.title, "Server Logs")
XCTAssertFalse(first.titleMatchIndices.isEmpty)
}

func testCommandContextFingerprintTracksExactContextValues() {
let base = ContentView.commandPaletteContextFingerprint(
boolValues: [
Expand Down
Loading