Minor progress
This commit is contained in:
parent
61f0a3d74c
commit
f0d76461dd
2 changed files with 22 additions and 10 deletions
BIN
breakfast
Executable file
BIN
breakfast
Executable file
Binary file not shown.
16
main.go
16
main.go
|
@ -13,7 +13,8 @@ type commandChoice struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type model struct {
|
type model struct {
|
||||||
cursor int
|
browserSessionsCursor int
|
||||||
|
commandsCursor int
|
||||||
browserSessions []string
|
browserSessions []string
|
||||||
commands []commandChoice
|
commands []commandChoice
|
||||||
selectedSessions map[int]struct{}
|
selectedSessions map[int]struct{}
|
||||||
|
@ -58,16 +59,27 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
m.cursor--
|
m.cursor--
|
||||||
}
|
}
|
||||||
case "down", "j":
|
case "down", "j":
|
||||||
if m.cursor < len(m.choices)-1 {
|
if m.cursor < len(m.browserSessions)+len(m.commands)-1 {
|
||||||
m.cursor++
|
m.cursor++
|
||||||
}
|
}
|
||||||
case "enter", " ":
|
case "enter", " ":
|
||||||
|
// TODO: Let's have two separate cursors, and have tab move the active
|
||||||
|
// set from brower sessions to terminals.
|
||||||
|
if m.cursor < len(m.browserSessions)-1 {
|
||||||
_, ok := m.selected[m.cursor]
|
_, ok := m.selected[m.cursor]
|
||||||
if ok {
|
if ok {
|
||||||
delete(m.selected, m.cursor)
|
delete(m.selected, m.cursor)
|
||||||
} else {
|
} else {
|
||||||
m.selected[m.cursor] = struct{}{}
|
m.selected[m.cursor] = struct{}{}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_, ok := m.selected[m.cursor]
|
||||||
|
if ok {
|
||||||
|
delete(m.selected, m.cursor)
|
||||||
|
} else {
|
||||||
|
m.selected[m.cursor] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue