Skip to content

Commit

Permalink
[bugfix]<history>: fix choose item (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: o98k-ok <hggend@gmail.com>
  • Loading branch information
o98k-ok authored Mar 12, 2024
1 parent d56e39d commit 4d7b4e0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions internal/ui/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/duke-git/lancet/v2/strutil"
"github.com/o98k-ok/voice/internal/music"
"github.com/o98k-ok/voice/internal/pkg"
"github.com/o98k-ok/voice/internal/player"
Expand Down Expand Up @@ -96,22 +95,13 @@ func (hl *HistoryList) fechList(off, limit int) [][]string {
func (hl *HistoryList) MsgKeyBindings() map[string]map[string]func(interface{}) tea.Cmd {
return map[string]map[string]func(interface{}) tea.Cmd{
"tea.KeyMsg": {
ALLMsgKey: func(v interface{}) tea.Cmd {
if !hl.active || strutil.ContainsAny(v.(tea.KeyMsg).String(), []string{" ", "left", "right"}) {
return nil
}
hl.list.table.Focus()

hl.list.ResetList(hl.fechByBvID(hl.player.CurrentElem.Value.(*music.Music).BvID, 10))
var cmd tea.Cmd
hl.list.table, cmd = hl.list.table.Update(v)
return cmd
},
"tab": func(i interface{}) tea.Cmd {
if !hl.active {
return nil
}

hl.list.table.Focus()
hl.list.ResetList(hl.fechByBvID(hl.player.CurrentElem.Value.(*music.Music).BvID, 10))
hl.list.table.SetCursor(hl.current)
return nil
},
Expand Down Expand Up @@ -168,6 +158,16 @@ func (hl *HistoryList) MsgKeyBindings() map[string]map[string]func(interface{})
hl.list.table, cmd = hl.list.table.Update(i)
return cmd
},
"up": func(i interface{}) tea.Cmd {
var cmd tea.Cmd
hl.list.table, cmd = hl.list.table.Update(i)
return cmd
},
"down": func(i interface{}) tea.Cmd {
var cmd tea.Cmd
hl.list.table, cmd = hl.list.table.Update(i)
return cmd
},
},
}
}
Expand Down

0 comments on commit 4d7b4e0

Please sign in to comment.