@@ -15,6 +15,7 @@ import (
1515 "sync"
1616 "time"
1717 "unicode"
18+ "unicode/utf8"
1819
1920 "github.com/abiosoft/readline"
2021 "github.com/fatih/color"
@@ -29,6 +30,11 @@ const (
2930var (
3031 errNoHandler = errors .New ("incorrect input, try 'help'" )
3132 errNoInterruptHandler = errors .New ("no interrupt handler" )
33+ strMultiChoice = " ❯"
34+ strMultiChoiceWin = " >"
35+ strMultiChoiceSpacer = " "
36+ strMultiChoiceOpen = "⬡ "
37+ strMultiChoiceSelect = "⬢ "
3238)
3339
3440// Shell is an interactive cli shell.
@@ -599,25 +605,25 @@ func (s *Shell) multiChoice(options []string, text string, init []int, multiResu
599605
600606func buildOptionsStrings (options []string , selected []int , index int ) []string {
601607 var strs []string
602- symbol := " ❯"
608+ symbol := strMultiChoice
603609 if runtime .GOOS == "windows" {
604- symbol = " >"
610+ symbol = strMultiChoiceWin
605611 }
606612 for i , opt := range options {
607- mark := "⬡ "
613+ mark := strMultiChoiceOpen
608614 if selected == nil {
609- mark = " "
615+ mark = strMultiChoiceSpacer
610616 }
611617 for _ , s := range selected {
612618 if s == i {
613- mark = "⬢ "
619+ mark = strMultiChoiceSelect
614620 }
615621 }
616622 if i == index {
617623 cyan := color .New (color .FgCyan ).Add (color .Bold ).SprintFunc ()
618624 strs = append (strs , cyan (symbol + mark + opt ))
619625 } else {
620- strs = append (strs , " " + mark + opt )
626+ strs = append (strs , strings . Repeat ( " " , utf8 . RuneCountInString ( symbol )) + mark + opt )
621627 }
622628 }
623629 return strs
0 commit comments