@@ -923,9 +923,19 @@ export interface SearchMatchHint {
923923}
924924
925925// Most threads' branches start with the app's own worktree prefix ("t3/", and
926- // "t3code/" before it), so "t3 connect" would match nearly every thread.
926+ // "t3code/" before it, "t3-<hex>" when a "t3" branch blocks nested refs), so
927+ // "t3 connect" would match nearly every thread.
927928// Only before more text, so typing "t3/" does not empty the list for a keystroke.
928- const WORKTREE_BRANCH_PREFIX_PATTERN = new RegExp ( `^(?:${ WORKTREE_BRANCH_PREFIX } |t3code)/(?=\\S)` ) ;
929+ const WORKTREE_BRANCH_PREFIX_PATTERN = new RegExp (
930+ `^(?:(?:${ WORKTREE_BRANCH_PREFIX } |t3code)/(?=\\S)|${ WORKTREE_BRANCH_PREFIX } -(?=[0-9a-f]{8}$))` ,
931+ ) ;
932+
933+ // The flat prefix anywhere in a query, while its hex is still being typed, so
934+ // "t3-abcd" and "connect t3-abcd1234" still reach the stripped branch field.
935+ const FLAT_BRANCH_QUERY_PREFIX_PATTERN = new RegExp (
936+ `(^| )${ WORKTREE_BRANCH_PREFIX } -(?=[0-9a-f]{1,8}(?: |$))` ,
937+ "g" ,
938+ ) ;
929939
930940function searchableBranch ( branch : string | null | undefined ) : string | null {
931941 return branch ? branch . replace ( WORKTREE_BRANCH_PREFIX_PATTERN , "" ) : null ;
@@ -1005,7 +1015,8 @@ function threadFieldQuery(normalizedQuery: string): string {
10051015 fieldQuery : normalizedQuery
10061016 . replace ( / ^ (?: p r | p u l l r e q u e s t | p u l l ) \s * (? = # ? \d ) / , "" )
10071017 . replace ( / ^ # \s * / , "" )
1008- . replace ( WORKTREE_BRANCH_PREFIX_PATTERN , "" ) ,
1018+ . replace ( WORKTREE_BRANCH_PREFIX_PATTERN , "" )
1019+ . replace ( FLAT_BRANCH_QUERY_PREFIX_PATTERN , "$1" ) ,
10091020 } ;
10101021 }
10111022 return lastFieldQuery . fieldQuery ;
0 commit comments