feat: create dialog
This commit is contained in:
@@ -27,3 +27,29 @@ func CheckFocus(prims ...tview.Primitive) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func AlignStringListWidth(list []string) ([]string, int) {
|
||||
var (
|
||||
m = 0
|
||||
alignedList = make([]string, 0)
|
||||
)
|
||||
|
||||
for _, item := range list {
|
||||
if len(item) > m {
|
||||
m = len(item)
|
||||
}
|
||||
}
|
||||
|
||||
for _, item := range list {
|
||||
if len(item) < m {
|
||||
need := m - len(item)
|
||||
for i := 0; i < need; i++ {
|
||||
item += " "
|
||||
}
|
||||
}
|
||||
|
||||
alignedList = append(alignedList, item)
|
||||
}
|
||||
|
||||
return alignedList, m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user