HandleTime
This commit is contained in:
12
wdgt_list.go
12
wdgt_list.go
@@ -63,8 +63,8 @@ func (w *List) Init(id string, style tcell.Style) {
|
||||
w.style = style
|
||||
w.focusable = true
|
||||
w.keyMap = NewKeyMap(map[tcell.Key]func(ev *tcell.EventKey) bool{
|
||||
tcell.KeyUp: w.MoveUp,
|
||||
tcell.KeyDown: w.MoveDown,
|
||||
tcell.KeyUp: func(_ *tcell.EventKey) bool { return w.MoveUp() },
|
||||
tcell.KeyDown: func(_ *tcell.EventKey) bool { return w.MoveDown() },
|
||||
tcell.KeyEnter: func(ev *tcell.EventKey) bool {
|
||||
if w.onSelect != nil && w.cursor < len(w.list) {
|
||||
return w.onSelect(w.cursor, w.list[w.cursor])
|
||||
@@ -74,13 +74,13 @@ func (w *List) Init(id string, style tcell.Style) {
|
||||
})
|
||||
w.keyMap.AddRune('j', func(ev *tcell.EventKey) bool {
|
||||
if w.vimMode {
|
||||
return w.MoveDown(ev)
|
||||
return w.MoveDown()
|
||||
}
|
||||
return false
|
||||
})
|
||||
w.keyMap.AddRune('k', func(ev *tcell.EventKey) bool {
|
||||
if w.vimMode {
|
||||
return w.MoveUp(ev)
|
||||
return w.MoveUp()
|
||||
}
|
||||
return false
|
||||
})
|
||||
@@ -189,7 +189,7 @@ func (w *List) MinW() int {
|
||||
func (w *List) MinH() int { return 4 }
|
||||
|
||||
func (w *List) SetCursorWrap(b bool) { w.cursorWrap = b }
|
||||
func (w *List) MoveUp(ev *tcell.EventKey) bool {
|
||||
func (w *List) MoveUp() bool {
|
||||
if w.cursor > 0 {
|
||||
w.cursor--
|
||||
return true
|
||||
@@ -200,7 +200,7 @@ func (w *List) MoveUp(ev *tcell.EventKey) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *List) MoveDown(ev *tcell.EventKey) bool {
|
||||
func (w *List) MoveDown() bool {
|
||||
if w.cursor < len(w.list)-1 {
|
||||
w.cursor++
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user