Some work

This commit is contained in:
2025-10-18 15:25:42 -05:00
parent 25777066cd
commit b00f1ce9c5
3 changed files with 31 additions and 12 deletions

View File

@@ -22,6 +22,7 @@ THE SOFTWARE.
package widgets
import (
h "git.bullercodeworks.com/brian/tcell-widgets/helpers"
wh "git.bullercodeworks.com/brian/tcell-widgets/helpers"
"github.com/gdamore/tcell"
)
@@ -235,9 +236,7 @@ func (w *SimpleList) WantH() int {
func (w *SimpleList) MinW() int {
lng := wh.Longest(w.list)
if lng > 80 {
lng = 80
}
lng = h.Min(lng, 80)
return 2 + lng
}
@@ -252,6 +251,9 @@ func (w *SimpleList) MoveUp() bool {
}
return true
} else if w.cursorWrap {
if w.cursor <= 0 {
return false
}
w.cursor = len(w.list) - 1
if w.onChange != nil {
w.onChange(w.cursor, w.list[w.cursor])
@@ -270,7 +272,7 @@ func (w *SimpleList) MoveDown() bool {
return true
} else if w.cursorWrap {
w.cursor = 0
if w.onChange != nil {
if len(w.list) > w.cursor && w.onChange != nil {
w.onChange(w.cursor, w.list[w.cursor])
}
return true