@@ -159,8 +159,7 @@ func runInit(cfg *config.Config, opts *initOptions) error {
159159 } else if opts .numbered {
160160 // === NUMBERED PATH (unchanged) ===
161161 if opts .prefix == "" && cfg .IsInteractive () {
162- p := prompter .New (cfg .In , cfg .Out , cfg .Err )
163- prefixInput , err := p .Input ("Enter a branch prefix (required for --numbered)" , "" )
162+ prefixInput , err := inputWithPrefill (cfg , "Enter a branch prefix (required for --numbered):" , "" )
164163 if err != nil {
165164 if isInterruptError (err ) {
166165 printInterrupt (cfg )
@@ -377,15 +376,15 @@ func runInteractiveInit(cfg *config.Config, sf *stack.StackFile, trunk, currentB
377376 branchName = currentBranch
378377 } else {
379378 // Create a new branch — fall through to input prompt
380- name , err := promptBranchName (cfg , p , opts .prefix )
379+ name , err := promptBranchName (cfg , opts .prefix )
381380 if err != nil {
382381 return nil , false , err
383382 }
384383 branchName = name
385384 }
386385 } else {
387386 // On trunk or detached HEAD — prompt for name directly
388- name , err := promptBranchName (cfg , p , opts .prefix )
387+ name , err := promptBranchName (cfg , opts .prefix )
389388 if err != nil {
390389 return nil , false , err
391390 }
@@ -430,14 +429,16 @@ func runInteractiveInit(cfg *config.Config, sf *stack.StackFile, trunk, currentB
430429 return []string {branchName }, wasAdopted , nil
431430}
432431
433- // promptBranchName prompts the user for a branch name, applying the
434- // explicit --prefix if set.
435- func promptBranchName (cfg * config.Config , p * prompter.Prompter , prefix string ) (string , error ) {
436- prompt := "What's the name of the first branch?"
432+ // promptBranchName prompts the user for a branch name, pre-filling the
433+ // prefix in the input when set so the user can see and edit the full name.
434+ func promptBranchName (cfg * config.Config , prefix string ) (string , error ) {
435+ prefill := ""
436+ prompt := "What's the name of the first branch:"
437437 if prefix != "" {
438- prompt = fmt .Sprintf ("Enter a name for the first branch (will be prefixed with %s/)" , prefix )
438+ prompt = "Enter a name for the first branch:"
439+ prefill = prefix + "/"
439440 }
440- branchName , err := p . Input ( prompt , "" )
441+ branchName , err := inputWithPrefill ( cfg , prompt , prefill )
441442 if err != nil {
442443 if isInterruptError (err ) {
443444 printInterrupt (cfg )
@@ -451,9 +452,6 @@ func promptBranchName(cfg *config.Config, p *prompter.Prompter, prefix string) (
451452 cfg .Errorf ("branch name cannot be empty" )
452453 return "" , ErrInvalidArgs
453454 }
454- if prefix != "" {
455- branchName = prefix + "/" + branchName
456- }
457455 return branchName , nil
458456}
459457
0 commit comments