Fixed some small paper-cuts

- Fixed a bug that was pushing duplicate view entries to the backstack
- The appended column will now be selected once added
This commit is contained in:
Leon Mika 2022-10-16 09:50:27 +11:00
parent b51c13dfb1
commit bfd0943c4f
14 changed files with 155 additions and 46 deletions

View file

@ -10,6 +10,7 @@ import (
"github.com/lmika/audax/internal/dynamo-browse/ui/keybindings"
"github.com/lmika/audax/internal/dynamo-browse/ui/teamodels/layout"
table "github.com/lmika/go-bubble-table"
"log"
"strings"
)
@ -46,6 +47,12 @@ func (c *colListModel) Init() tea.Cmd {
func (m *colListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case controllers.SetSelectedColumnInColSelector:
// HACK: this needs to work for all cases
log.Printf("%d == %d?", int(msg), m.table.Cursor()+1)
if int(msg) == m.table.Cursor()+1 {
m.table.GoDown()
}
case tea.KeyMsg:
switch {
// Column operations

View file

@ -49,6 +49,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case controllers.ColumnsUpdated:
m.colListModel.refreshTable()
m.subModel = cc.Collect(m.subModel.Update(msg)).(tea.Model)
case controllers.SetSelectedColumnInColSelector:
m.compositor = cc.Collect(m.compositor.Update(msg)).(*layout.Compositor)
case tea.KeyMsg:
m.compositor = cc.Collect(m.compositor.Update(msg)).(*layout.Compositor)
default: