From 8fafea4fc32d39df8e760acc76c4b23d2d90abaa Mon Sep 17 00:00:00 2001 From: Jonathan van Rij Date: Wed, 30 Sep 2026 15:18:42 +0200 Subject: [PATCH] Fixing stuff --- Sources/HelderUI/Shell/Command.swift | 4 ++-- Sources/HelderUI/Shell/KeyRouter.swift | 2 +- Tests/HelderUITests/Shell/KeyRouterTests.swift | 4 ++-- docs/design/README.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/HelderUI/Shell/Command.swift b/Sources/HelderUI/Shell/Command.swift index 429530e..b3a8505 100644 --- a/Sources/HelderUI/Shell/Command.swift +++ b/Sources/HelderUI/Shell/Command.swift @@ -6,7 +6,7 @@ import HelderCore /// first responder when it names them. public enum FocusTarget: Equatable, Sendable { case panel(Panel) - /// ⌘C without a selection: the commit message field. + /// ⌘C without a selection, outside a terminal: the commit message field. case commitMessage } @@ -114,7 +114,7 @@ public enum Command: Equatable, Sendable { case commit /// ⌘P case push - /// ⌘C without a selection + /// ⌘C without a selection, outside a terminal case focusCommitMessage // MARK: Note diff --git a/Sources/HelderUI/Shell/KeyRouter.swift b/Sources/HelderUI/Shell/KeyRouter.swift index 7d144d7..8fbf11f 100644 --- a/Sources/HelderUI/Shell/KeyRouter.swift +++ b/Sources/HelderUI/Shell/KeyRouter.swift @@ -186,7 +186,7 @@ public enum KeyRouter { case ".": return .perform(.toggleHidden) case "a": return context.owner == .workspace ? .perform(.selectAllInFile) : .pass case "c": - if context.hasTextSelection || context.hasEditorLineSelection { return .pass } + if context.owner == .terminal || context.hasTextSelection || context.hasEditorLineSelection { return .pass } return .perform(.focusCommitMessage) default: return .pass } diff --git a/Tests/HelderUITests/Shell/KeyRouterTests.swift b/Tests/HelderUITests/Shell/KeyRouterTests.swift index c510009..b106156 100644 --- a/Tests/HelderUITests/Shell/KeyRouterTests.swift +++ b/Tests/HelderUITests/Shell/KeyRouterTests.swift @@ -33,11 +33,11 @@ import Testing #expect(route(cmd("a"), KeyContext(owner: .terminal)) == .pass) } - @Test func commandCFocusesTheCommitBoxUnlessThereIsSomethingToCopy() { + @Test func commandCFocusesTheCommitBoxOutsideTheTerminalUnlessThereIsSomethingToCopy() { #expect(route(cmd("c")) == .perform(.focusCommitMessage)) #expect(route(cmd("c"), KeyContext(owner: .text(in: .editor), hasTextSelection: true)) == .pass) #expect(route(cmd("c"), KeyContext(hasEditorLineSelection: true)) == .pass) - #expect(route(cmd("c"), KeyContext(owner: .terminal)) == .perform(.focusCommitMessage)) + #expect(route(cmd("c"), KeyContext(owner: .terminal)) == .pass) #expect(route(cmd("c"), KeyContext(owner: .terminal, hasTextSelection: true)) == .pass) } diff --git a/docs/design/README.md b/docs/design/README.md index 8a70d45..abf7bdc 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -330,7 +330,7 @@ gets room: | `↵` | Open the selected row (search hit, file, recent project) | | `⌘→` (editor) | Pass the current selection to the agent | | `⌘M` | Markdown: code or rendered preview | -| `⌘C` / `⌘↵` / `⌘P` (git) | Focus commit message / commit staged / push branch | +| `⌘C` / `⌘↵` / `⌘P` (git) | Focus commit message (not from a terminal) / commit staged / push branch | | `⌘A` | Toggle auto-fit panels (columns re-fit on resize and focus) | | `⌘.` | Toggle hidden dotfiles in tree and search | | `⌘G` | Show or hide the source-control column |