toggling between views made possible

This commit is contained in:
2026-11-09 14:01:49 +01:00
parent cc6651c08a
commit 2887965a9e
18 changed files with 149 additions and 17 deletions
+13
View File
@@ -99,6 +99,8 @@ public enum OverlayKind: Equatable, Sendable {
/// The full-screen Diff: the workspace shortcuts keep working over it. `busy` while its own
/// menu or pass-on prompt is open; those then own every key.
case diff(busy: Bool)
/// The search: it owns every key but Esc, ⌘G and ⌘D, so it can switch to the Git or Schema view.
case search
/// Any other overlay: it owns every key but Esc.
case other
@@ -106,6 +108,7 @@ public enum OverlayKind: Equatable, Sendable {
switch overlay {
case .none: self = .none
case .diff: self = .diff(busy: diffBusy)
case .search: self = .search
default: self = .other
}
}
@@ -141,6 +144,7 @@ public enum KeyRouter {
case .none: break
case .diff:
if press == .cmd(.character("a")) { return .pass }
case .search: return searchKey(press, context)
case .other: return .pass
}
@@ -163,6 +167,15 @@ public enum KeyRouter {
}
}
private static func searchKey(_ press: KeyPress, _ context: KeyContext) -> KeyRoute {
guard press.command, !press.shift else { return .pass }
switch press.key {
case .character("g"): return .perform(.toggleGit)
case .character("d"): return context.schemaAvailable ? .perform(.toggleSchemaView) : .pass
default: return .pass
}
}
private static func schemaEscape(_ context: KeyContext) -> KeyRoute {
if context.schemaHasSelection { return .perform(.clearSchemaSelection) }
if context.schemaSearchHasText { return .perform(.clearSchemaSearch) }