fix back hint in help views
This commit is contained in:
parent
a92ea6df48
commit
e8361766b3
12 changed files with 61 additions and 117 deletions
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -66,19 +65,7 @@ func NewInstallation(root components.RootModel, parent tea.Model, installationDa
|
||||||
model.list.Styles = utils.ListStyles
|
model.list.Styles = utils.ListStyles
|
||||||
model.list.SetSize(model.list.Width(), model.list.Height())
|
model.list.SetSize(model.list.Width(), model.list.Height())
|
||||||
model.list.StatusMessageLifetime = time.Second * 3
|
model.list.StatusMessageLifetime = time.Second * 3
|
||||||
model.list.DisableQuitKeybindings()
|
model.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
|
|
||||||
model.list.AdditionalShortHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model.list.AdditionalFullHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,10 @@ func NewInstallations(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("q", "back")
|
l.KeyMap.Quit.SetHelp("q", "back")
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
l.AdditionalShortHelpKeys = func() []key.Binding {
|
l.AdditionalShortHelpKeys = func() []key.Binding {
|
||||||
return []key.Binding{
|
return []key.Binding{
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "new installation")),
|
||||||
key.NewBinding(key.WithHelp("n", "new installation")),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +49,6 @@ func (m installations) Init() tea.Cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m installations) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m installations) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// List enables its own keybindings when they were previously disabled
|
|
||||||
m.list.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
if m.list.SettingFilter() {
|
if m.list.SettingFilter() {
|
||||||
|
|
|
@ -42,8 +42,6 @@ func NewInstalledMods(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
l.Title = "Installed Mods"
|
l.Title = "Installed Mods"
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
l.AdditionalShortHelpKeys = func() []key.Binding {
|
l.AdditionalShortHelpKeys = func() []key.Binding {
|
||||||
return []key.Binding{
|
return []key.Binding{
|
||||||
|
@ -160,8 +158,7 @@ func (m installedModsList) LoadModData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m installedModsList) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m installedModsList) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// List enables its own keybindings when they were previously disabled
|
m.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
m.list.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
|
|
|
@ -127,7 +127,6 @@ func NewMainMenu(root components.RootModel) tea.Model {
|
||||||
model.list.SetFilteringEnabled(false)
|
model.list.SetFilteringEnabled(false)
|
||||||
model.list.Title = "Main Menu"
|
model.list.Title = "Main Menu"
|
||||||
model.list.Styles = utils.ListStyles
|
model.list.Styles = utils.ListStyles
|
||||||
model.list.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package scenes
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -101,21 +100,8 @@ func NewModMenu(root components.RootModel, parent tea.Model, mod utils.Mod) tea.
|
||||||
model.list.Title = mod.Name
|
model.list.Title = mod.Name
|
||||||
model.list.Styles = utils.ListStyles
|
model.list.Styles = utils.ListStyles
|
||||||
model.list.SetSize(model.list.Width(), model.list.Height())
|
model.list.SetSize(model.list.Width(), model.list.Height())
|
||||||
model.list.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
model.list.StatusMessageLifetime = time.Second * 3
|
model.list.StatusMessageLifetime = time.Second * 3
|
||||||
model.list.DisableQuitKeybindings()
|
model.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
|
|
||||||
model.list.AdditionalShortHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model.list.AdditionalFullHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package scenes
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -67,21 +66,8 @@ func NewModVersion(root components.RootModel, parent tea.Model, mod utils.Mod) t
|
||||||
model.list.Title = mod.Name
|
model.list.Title = mod.Name
|
||||||
model.list.Styles = utils.ListStyles
|
model.list.Styles = utils.ListStyles
|
||||||
model.list.SetSize(model.list.Width(), model.list.Height())
|
model.list.SetSize(model.list.Width(), model.list.Height())
|
||||||
model.list.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
model.list.StatusMessageLifetime = time.Second * 3
|
model.list.StatusMessageLifetime = time.Second * 3
|
||||||
model.list.DisableQuitKeybindings()
|
model.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
|
|
||||||
model.list.AdditionalShortHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model.list.AdditionalFullHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,6 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
l.Title = modsTitle
|
l.Title = modsTitle
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
l.AdditionalShortHelpKeys = func() []key.Binding {
|
l.AdditionalShortHelpKeys = func() []key.Binding {
|
||||||
return []key.Binding{
|
return []key.Binding{
|
||||||
|
@ -167,8 +165,6 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
sortFieldList.Title = modsTitle
|
sortFieldList.Title = modsTitle
|
||||||
sortFieldList.Styles = utils.ListStyles
|
sortFieldList.Styles = utils.ListStyles
|
||||||
sortFieldList.SetSize(l.Width(), l.Height())
|
sortFieldList.SetSize(l.Width(), l.Height())
|
||||||
sortFieldList.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
sortFieldList.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
sortOrderList := list.New([]list.Item{
|
sortOrderList := list.New([]list.Item{
|
||||||
utils.SimpleItemExtra[modsList, ficsit.ModsModsGetModsModsMod]{
|
utils.SimpleItemExtra[modsList, ficsit.ModsModsGetModsModsMod]{
|
||||||
|
@ -200,8 +196,6 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
sortOrderList.Title = modsTitle
|
sortOrderList.Title = modsTitle
|
||||||
sortOrderList.Styles = utils.ListStyles
|
sortOrderList.Styles = utils.ListStyles
|
||||||
sortOrderList.SetSize(l.Width(), l.Height())
|
sortOrderList.SetSize(l.Width(), l.Height())
|
||||||
sortOrderList.KeyMap.Quit.SetHelp("q", "back")
|
|
||||||
sortOrderList.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
m := &modsList{
|
m := &modsList{
|
||||||
root: root,
|
root: root,
|
||||||
|
@ -281,8 +275,7 @@ func (m modsList) Init() tea.Cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m modsList) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m modsList) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// List enables its own keybindings when they were previously disabled
|
m.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
m.list.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
|
|
|
@ -43,8 +43,6 @@ func NewNewInstallation(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("esc", "back")
|
l.KeyMap.Quit.SetHelp("esc", "back")
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
l.SetShowHelp(false)
|
|
||||||
l.SetShowStatusBar(false)
|
l.SetShowStatusBar(false)
|
||||||
|
|
||||||
model := newInstallation{
|
model := newInstallation{
|
||||||
|
@ -149,7 +147,8 @@ func (m newInstallation) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m newInstallation) View() string {
|
func (m newInstallation) View() string {
|
||||||
inputView := lipgloss.NewStyle().Padding(1, 2).Render(m.input.View())
|
style := lipgloss.NewStyle().Padding(1, 2)
|
||||||
|
inputView := style.Render(m.input.View())
|
||||||
|
|
||||||
mandatory := lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, inputView)
|
mandatory := lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, inputView)
|
||||||
|
|
||||||
|
@ -157,19 +156,18 @@ func (m newInstallation) View() string {
|
||||||
return lipgloss.JoinVertical(lipgloss.Left, mandatory, m.error.View())
|
return lipgloss.JoinVertical(lipgloss.Left, mandatory, m.error.View())
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.dirList.Items()) > 0 {
|
if len(m.dirList.Items()) == 0 {
|
||||||
m.dirList.SetSize(m.dirList.Width(), m.root.Size().Height-lipgloss.Height(mandatory)-1)
|
|
||||||
return lipgloss.JoinVertical(lipgloss.Left, mandatory, m.dirList.View())
|
|
||||||
}
|
|
||||||
|
|
||||||
infoBox := lipgloss.NewStyle().
|
infoBox := lipgloss.NewStyle().
|
||||||
BorderStyle(lipgloss.ThickBorder()).
|
BorderStyle(lipgloss.ThickBorder()).
|
||||||
BorderForeground(lipgloss.Color("39")).
|
BorderForeground(lipgloss.Color("39")).
|
||||||
Padding(0, 1).
|
Padding(0, 1).
|
||||||
Margin(0, 0, 0, 2).
|
Margin(0, 0, 0, 2).
|
||||||
Render("Enter the path to the satisfactory installation")
|
Render("Enter the path to the satisfactory installation")
|
||||||
|
mandatory = lipgloss.JoinVertical(lipgloss.Left, mandatory, infoBox)
|
||||||
|
}
|
||||||
|
|
||||||
return lipgloss.JoinVertical(lipgloss.Left, mandatory, infoBox)
|
m.dirList.SetSize(m.dirList.Width(), m.root.Size().Height-lipgloss.Height(mandatory)-1)
|
||||||
|
return lipgloss.JoinVertical(lipgloss.Left, mandatory, style.Render(m.dirList.View()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// I know this is awful, but beats re-implementing the entire list model
|
// I know this is awful, but beats re-implementing the entire list model
|
||||||
|
|
|
@ -3,6 +3,8 @@ package scenes
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/charmbracelet/bubbles/help"
|
||||||
|
"github.com/charmbracelet/bubbles/key"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -13,12 +15,30 @@ import (
|
||||||
|
|
||||||
var _ tea.Model = (*newProfile)(nil)
|
var _ tea.Model = (*newProfile)(nil)
|
||||||
|
|
||||||
|
type keyMap struct {
|
||||||
|
Back key.Binding
|
||||||
|
Quit key.Binding
|
||||||
|
Enter key.Binding
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k keyMap) ShortHelp() []key.Binding {
|
||||||
|
return []key.Binding{k.Enter, k.Back}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k keyMap) FullHelp() [][]key.Binding {
|
||||||
|
return [][]key.Binding{
|
||||||
|
{k.Enter, k.Back}, // second column
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type newProfile struct {
|
type newProfile struct {
|
||||||
input textinput.Model
|
input textinput.Model
|
||||||
root components.RootModel
|
root components.RootModel
|
||||||
parent tea.Model
|
parent tea.Model
|
||||||
error *components.ErrorComponent
|
error *components.ErrorComponent
|
||||||
title string
|
title string
|
||||||
|
help help.Model
|
||||||
|
keys keyMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNewProfile(root components.RootModel, parent tea.Model) tea.Model {
|
func NewNewProfile(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
|
@ -27,6 +47,20 @@ func NewNewProfile(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
parent: parent,
|
parent: parent,
|
||||||
input: textinput.New(),
|
input: textinput.New(),
|
||||||
title: utils.NonListTitleStyle.Render("New Profile"),
|
title: utils.NonListTitleStyle.Render("New Profile"),
|
||||||
|
help: help.New(),
|
||||||
|
keys: keyMap{
|
||||||
|
Back: key.NewBinding(
|
||||||
|
key.WithKeys(KeyEscape, KeyControlC),
|
||||||
|
key.WithHelp(KeyEscape, "back"),
|
||||||
|
),
|
||||||
|
Enter: key.NewBinding(
|
||||||
|
key.WithKeys(KeyEnter),
|
||||||
|
key.WithHelp(KeyEnter, "create"),
|
||||||
|
),
|
||||||
|
Quit: key.NewBinding(
|
||||||
|
key.WithKeys(KeyControlC),
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
model.input.Focus()
|
model.input.Focus()
|
||||||
|
@ -42,12 +76,12 @@ func (m newProfile) Init() tea.Cmd {
|
||||||
func (m newProfile) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m newProfile) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
switch keypress := msg.String(); keypress {
|
switch {
|
||||||
case KeyControlC:
|
case key.Matches(msg, m.keys.Quit):
|
||||||
return m, tea.Quit
|
return m, tea.Quit
|
||||||
case KeyEscape:
|
case key.Matches(msg, m.keys.Back):
|
||||||
return m.parent, nil
|
return m.parent, nil
|
||||||
case KeyEnter:
|
case key.Matches(msg, m.keys.Enter):
|
||||||
if _, err := m.root.GetGlobal().Profiles.AddProfile(m.input.Value()); err != nil {
|
if _, err := m.root.GetGlobal().Profiles.AddProfile(m.input.Value()); err != nil {
|
||||||
errorComponent, cmd := components.NewErrorComponent(err.Error(), time.Second*5)
|
errorComponent, cmd := components.NewErrorComponent(err.Error(), time.Second*5)
|
||||||
m.error = errorComponent
|
m.error = errorComponent
|
||||||
|
@ -74,7 +108,8 @@ func (m newProfile) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m newProfile) View() string {
|
func (m newProfile) View() string {
|
||||||
inputView := lipgloss.NewStyle().Padding(1, 2).Render(m.input.View())
|
style := lipgloss.NewStyle().Padding(1, 2)
|
||||||
|
inputView := style.Render(m.input.View())
|
||||||
|
|
||||||
if m.error != nil {
|
if m.error != nil {
|
||||||
return lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, m.error.View(), inputView)
|
return lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, m.error.View(), inputView)
|
||||||
|
@ -87,5 +122,5 @@ func (m newProfile) View() string {
|
||||||
Margin(0, 0, 0, 2).
|
Margin(0, 0, 0, 2).
|
||||||
Render("Enter the name of the profile")
|
Render("Enter the name of the profile")
|
||||||
|
|
||||||
return lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, inputView, infoBox)
|
return lipgloss.JoinVertical(lipgloss.Left, m.root.View(), m.title, inputView, infoBox, style.Render(m.help.View(m.keys)))
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -78,19 +77,7 @@ func NewProfile(root components.RootModel, parent tea.Model, profileData *cli.Pr
|
||||||
model.list.Styles = utils.ListStyles
|
model.list.Styles = utils.ListStyles
|
||||||
model.list.SetSize(model.list.Width(), model.list.Height())
|
model.list.SetSize(model.list.Width(), model.list.Height())
|
||||||
model.list.StatusMessageLifetime = time.Second * 3
|
model.list.StatusMessageLifetime = time.Second * 3
|
||||||
model.list.DisableQuitKeybindings()
|
model.list.KeyMap.Quit.SetHelp("q", "back")
|
||||||
|
|
||||||
model.list.AdditionalShortHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model.list.AdditionalFullHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,10 @@ func NewProfiles(root components.RootModel, parent tea.Model) tea.Model {
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("q", "back")
|
l.KeyMap.Quit.SetHelp("q", "back")
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
l.AdditionalShortHelpKeys = func() []key.Binding {
|
l.AdditionalShortHelpKeys = func() []key.Binding {
|
||||||
return []key.Binding{
|
return []key.Binding{
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "new profile")),
|
||||||
key.NewBinding(key.WithHelp("n", "new profile")),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +49,6 @@ func (m profiles) Init() tea.Cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m profiles) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m profiles) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// List enables its own keybindings when they were previously disabled
|
|
||||||
m.list.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
if m.list.SettingFilter() {
|
if m.list.SettingFilter() {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/key"
|
|
||||||
"github.com/charmbracelet/bubbles/list"
|
"github.com/charmbracelet/bubbles/list"
|
||||||
"github.com/charmbracelet/bubbles/spinner"
|
"github.com/charmbracelet/bubbles/spinner"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
@ -36,19 +35,6 @@ func NewModVersionList(root components.RootModel, parent tea.Model, mod utils.Mo
|
||||||
l.Styles = utils.ListStyles
|
l.Styles = utils.ListStyles
|
||||||
l.SetSize(l.Width(), l.Height())
|
l.SetSize(l.Width(), l.Height())
|
||||||
l.KeyMap.Quit.SetHelp("q", "back")
|
l.KeyMap.Quit.SetHelp("q", "back")
|
||||||
l.DisableQuitKeybindings()
|
|
||||||
|
|
||||||
l.AdditionalShortHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
l.AdditionalFullHelpKeys = func() []key.Binding {
|
|
||||||
return []key.Binding{
|
|
||||||
key.NewBinding(key.WithHelp("q", "back")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m := &selectModVersionList{
|
m := &selectModVersionList{
|
||||||
root: root,
|
root: root,
|
||||||
|
|
Loading…
Reference in a new issue