Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion Sources/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3088,7 +3088,7 @@ final class Workspace: Identifiable, ObservableObject {
switch source {
case .closeButton:
self?.markTabCloseButtonClose(surfaceId: tabId)
case .middleClick:
case .middleClick, .contextMenu:
self?.markTabStripMiddleClickClose(surfaceId: tabId)
}
}
Expand Down Expand Up @@ -9662,6 +9662,7 @@ final class Workspace: Identifiable, ObservableObject {
var shortcuts: [TabContextAction: KeyboardShortcut] = [:]
let mappings: [(TabContextAction, KeyboardShortcutSettings.Action)] = [
(.rename, .renameTab),
(.close, .closeTab),
(.toggleZoom, .toggleSplitZoom),
(.newTerminalToRight, .newSurface),
]
Expand Down Expand Up @@ -12611,6 +12612,9 @@ extension Workspace: BonsplitDelegate {
case .clearName:
guard let panelId = panelIdFromSurfaceId(tab.id) else { return }
setPanelCustomTitle(panelId: panelId, title: nil)
case .close:
// Bonsplit handles this through its shared tab-close request path.
break
case .copyIdentifiers:
guard let panelId = panelIdFromSurfaceId(tab.id) else { return }
copyIdentifiersToPasteboard(surfaceId: panelId)
Expand Down Expand Up @@ -12651,6 +12655,8 @@ extension Workspace: BonsplitDelegate {
case .duplicate:
guard let panelId = panelIdFromSurfaceId(tab.id) else { return }
_ = duplicateBrowserToRight(panelId: panelId)
case .disconnectRemote:
disconnectRemoteConnection(clearConfiguration: false)
Comment on lines +12658 to +12659

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 disconnectRemoteConnection ignores tab.id

The handler disconnects the workspace-level SSH connection without verifying that the right-clicked tab.id corresponds to the panel that owns the remote session. For a workspace where the context menu is shown on a local (non-SSH) tab while a remote connection exists in a sibling pane, this silently disconnects the connection the user did not intend to affect. Other SSH-related guard patterns in this switch (e.g. .reload, .toggleAudioMute) validate via panelIdFromSurfaceId before acting. At minimum, consider gating with guard panelIdFromSurfaceId(tab.id) != nil or checking remoteConfiguration ownership before dispatching.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

case .togglePin:
guard let panelId = panelIdFromSurfaceId(tab.id) else { return }
let shouldPin = !pinnedPanelIds.contains(panelId)
Expand Down