feat: create dialog

This commit is contained in:
2024-01-20 21:58:49 -06:00
parent c24251cfbf
commit 639788d37b
11 changed files with 715 additions and 62 deletions

View File

@@ -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
}