diff --git a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx index 0ea81f965..e107cb244 100644 --- a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx +++ b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx @@ -5,6 +5,7 @@ import { invalidateGitBranchQueries } from "@features/git-interaction/utils/gitC import { ArrowClockwise, CaretDown, + Check, GitBranch, Plus, Spinner, @@ -175,6 +176,16 @@ export function BranchSelector({ const isDisabled = !!(disabled || !repoPath || cloudStillLoading); const inputValue = isCloudMode ? (cloudSearchQuery ?? "") : searchQuery; + const trimmedInputValue = inputValue.trim(); + const canUseInputBranch = + !isDisabled && + trimmedInputValue.length > 0 && + trimmedInputValue !== displayedBranch; + + const handleUseInputBranch = () => { + if (!canUseInputBranch) return; + handleBranchChange(trimmedInputValue); + }; return ( { + if ( + event.key !== "Enter" || + event.nativeEvent.isComposing || + !canUseInputBranch + ) { + return; + } + + // If the combobox already has a highlighted item, let Base UI select it. + if (event.currentTarget.getAttribute("aria-activedescendant")) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + handleUseInputBranch(); + }} /> + + + {onRefresh ? (