Fix SSH review regressions
This commit is contained in:
parent
d7353d3aa1
commit
a75faa82f1
5 changed files with 328 additions and 24 deletions
|
|
@ -10477,20 +10477,59 @@ private struct TabItemView: View, Equatable {
|
|||
}
|
||||
|
||||
private var remoteStateHelpText: String {
|
||||
let target = tab.remoteDisplayTarget ?? "remote host"
|
||||
let target = tab.remoteDisplayTarget ?? String(
|
||||
localized: "sidebar.remote.help.targetFallback",
|
||||
defaultValue: "remote host"
|
||||
)
|
||||
let detail = tab.remoteConnectionDetail?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
switch tab.remoteConnectionState {
|
||||
case .connected:
|
||||
return "SSH connected to \(target)"
|
||||
return String(
|
||||
format: String(
|
||||
localized: "sidebar.remote.help.connected",
|
||||
defaultValue: "SSH connected to %@"
|
||||
),
|
||||
locale: .current,
|
||||
target
|
||||
)
|
||||
case .connecting:
|
||||
return "SSH connecting to \(target)"
|
||||
return String(
|
||||
format: String(
|
||||
localized: "sidebar.remote.help.connecting",
|
||||
defaultValue: "SSH connecting to %@"
|
||||
),
|
||||
locale: .current,
|
||||
target
|
||||
)
|
||||
case .error:
|
||||
if let detail, !detail.isEmpty {
|
||||
return "SSH error for \(target): \(detail)"
|
||||
return String(
|
||||
format: String(
|
||||
localized: "sidebar.remote.help.errorWithDetail",
|
||||
defaultValue: "SSH error for %@: %@"
|
||||
),
|
||||
locale: .current,
|
||||
target,
|
||||
detail
|
||||
)
|
||||
}
|
||||
return "SSH error for \(target)"
|
||||
return String(
|
||||
format: String(
|
||||
localized: "sidebar.remote.help.error",
|
||||
defaultValue: "SSH error for %@"
|
||||
),
|
||||
locale: .current,
|
||||
target
|
||||
)
|
||||
case .disconnected:
|
||||
return "SSH disconnected from \(target)"
|
||||
return String(
|
||||
format: String(
|
||||
localized: "sidebar.remote.help.disconnected",
|
||||
defaultValue: "SSH disconnected from %@"
|
||||
),
|
||||
locale: .current,
|
||||
target
|
||||
)
|
||||
}
|
||||
}
|
||||
private func moveWorkspaces(_ workspaceIds: [UUID], toWindow windowId: UUID) {
|
||||
|
|
|
|||
|
|
@ -19,22 +19,31 @@ enum NewWorkspacePlacement: String, CaseIterable, Identifiable {
|
|||
var displayName: String {
|
||||
switch self {
|
||||
case .top:
|
||||
return "Top"
|
||||
return String(localized: "workspace.placement.top", defaultValue: "Top")
|
||||
case .afterCurrent:
|
||||
return "After current"
|
||||
return String(localized: "workspace.placement.afterCurrent", defaultValue: "After current")
|
||||
case .end:
|
||||
return "End"
|
||||
return String(localized: "workspace.placement.end", defaultValue: "End")
|
||||
}
|
||||
}
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .top:
|
||||
return "Insert new workspaces at the top of the list."
|
||||
return String(
|
||||
localized: "workspace.placement.top.description",
|
||||
defaultValue: "Insert new workspaces at the top of the list."
|
||||
)
|
||||
case .afterCurrent:
|
||||
return "Insert new workspaces directly after the active workspace."
|
||||
return String(
|
||||
localized: "workspace.placement.afterCurrent.description",
|
||||
defaultValue: "Insert new workspaces directly after the active workspace."
|
||||
)
|
||||
case .end:
|
||||
return "Append new workspaces to the bottom of the list."
|
||||
return String(
|
||||
localized: "workspace.placement.end.description",
|
||||
defaultValue: "Append new workspaces to the bottom of the list."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -732,7 +741,7 @@ class TabManager: ObservableObject {
|
|||
}
|
||||
|
||||
var isFindVisible: Bool {
|
||||
selectedTerminalPanel?.searchState != nil
|
||||
selectedTerminalPanel?.searchState != nil || focusedBrowserPanel?.searchState != nil
|
||||
}
|
||||
|
||||
var canUseSelectionForFind: Bool {
|
||||
|
|
@ -740,13 +749,17 @@ class TabManager: ObservableObject {
|
|||
}
|
||||
|
||||
func startSearch() {
|
||||
guard let panel = selectedTerminalPanel else { return }
|
||||
if panel.searchState == nil {
|
||||
panel.searchState = TerminalSurface.SearchState()
|
||||
if let panel = selectedTerminalPanel {
|
||||
if panel.searchState == nil {
|
||||
panel.searchState = TerminalSurface.SearchState()
|
||||
}
|
||||
NSLog("Find: startSearch workspace=%@ panel=%@", panel.workspaceId.uuidString, panel.id.uuidString)
|
||||
NotificationCenter.default.post(name: .ghosttySearchFocus, object: panel.surface)
|
||||
_ = panel.performBindingAction("start_search")
|
||||
return
|
||||
}
|
||||
NSLog("Find: startSearch workspace=%@ panel=%@", panel.workspaceId.uuidString, panel.id.uuidString)
|
||||
NotificationCenter.default.post(name: .ghosttySearchFocus, object: panel.surface)
|
||||
_ = panel.performBindingAction("start_search")
|
||||
|
||||
focusedBrowserPanel?.startFind()
|
||||
}
|
||||
|
||||
func searchSelection() {
|
||||
|
|
@ -760,11 +773,21 @@ class TabManager: ObservableObject {
|
|||
}
|
||||
|
||||
func findNext() {
|
||||
_ = selectedTerminalPanel?.performBindingAction("search:next")
|
||||
if let panel = selectedTerminalPanel {
|
||||
_ = panel.performBindingAction("search:next")
|
||||
return
|
||||
}
|
||||
|
||||
focusedBrowserPanel?.findNext()
|
||||
}
|
||||
|
||||
func findPrevious() {
|
||||
_ = selectedTerminalPanel?.performBindingAction("search:previous")
|
||||
if let panel = selectedTerminalPanel {
|
||||
_ = panel.performBindingAction("search:previous")
|
||||
return
|
||||
}
|
||||
|
||||
focusedBrowserPanel?.findPrevious()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
|
|
@ -774,7 +797,12 @@ class TabManager: ObservableObject {
|
|||
}
|
||||
|
||||
func hideFind() {
|
||||
selectedTerminalPanel?.searchState = nil
|
||||
if let panel = selectedTerminalPanel {
|
||||
panel.searchState = nil
|
||||
return
|
||||
}
|
||||
|
||||
focusedBrowserPanel?.hideFind()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
|
|
@ -1234,6 +1262,7 @@ class TabManager: ObservableObject {
|
|||
sentryBreadcrumb("workspace.close", data: ["tabCount": tabs.count - 1])
|
||||
|
||||
AppDelegate.shared?.notificationStore?.clearNotifications(forTabId: workspace.id)
|
||||
workspace.teardownAllPanels()
|
||||
workspace.teardownRemoteConnection()
|
||||
unwireClosedBrowserTracking(for: workspace)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue