Some work

This commit is contained in:
2025-10-09 12:24:00 -05:00
parent 28a9824542
commit 79a212e601
3 changed files with 247 additions and 48 deletions

View File

@@ -212,8 +212,13 @@ func (w *SimpleList) MoveDown() bool {
}
func (w *SimpleList) SetTitle(ttl string) { w.title = ttl }
func (w *SimpleList) SetList(l []string) { w.list = l }
func (w *SimpleList) Clear() { w.list = []string{} }
func (w *SimpleList) Add(l string) { w.list = append(w.list, l) }
func (w *SimpleList) Clear() {
w.list = []string{}
for k := range w.itemsStyle {
delete(w.itemsStyle, k)
}
}
func (w *SimpleList) Add(l string) { w.list = append(w.list, l) }
func (w *SimpleList) Remove(l string) {
var idx int
var found bool
@@ -242,7 +247,15 @@ func (w *SimpleList) SetItem(idx int, txt string) {
w.list[idx] = txt
}
}
func (w *SimpleList) SelectedIndex() int { return w.cursor }
func (w *SimpleList) SelectedIndex() int { return w.cursor }
func (w *SimpleList) SetSelectedIndex(i int) {
if i < 0 {
i = 0
} else if i >= len(w.list) {
i = len(w.list) - 1
}
w.cursor = i
}
func (w *SimpleList) ClearBorder() { w.border = []rune{} }
func (w *SimpleList) SetOnSelect(s func(int, string) bool) { w.onSelect = s }
func (w *SimpleList) SetVimMode(b bool) { w.vimMode = b }