mirror of
https://github.com/charmbracelet/gum
synced 2024-06-29 10:40:28 +02:00
Fixing linter issues
This commit is contained in:
parent
40d1ab1fc7
commit
f2e21b067a
|
@ -47,14 +47,7 @@ type item struct {
|
||||||
|
|
||||||
func (m model) Init() tea.Cmd { return nil }
|
func (m model) Init() tea.Cmd { return nil }
|
||||||
|
|
||||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m *model) handleSelectKeys(msg tea.KeyMsg) tea.Cmd {
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
|
||||||
case tea.WindowSizeMsg:
|
|
||||||
return m, nil
|
|
||||||
|
|
||||||
case tea.KeyMsg:
|
|
||||||
if m.inputModel.inputState == SELECT {
|
|
||||||
start, end := m.inputModel.paginator.GetSliceBounds(len(m.items))
|
start, end := m.inputModel.paginator.GetSliceBounds(len(m.items))
|
||||||
switch keypress := msg.String(); keypress {
|
switch keypress := msg.String(); keypress {
|
||||||
case "down", "j", "ctrl+n":
|
case "down", "j", "ctrl+n":
|
||||||
|
@ -112,7 +105,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
case "ctrl+c", "esc":
|
case "ctrl+c", "esc":
|
||||||
m.aborted = true
|
m.aborted = true
|
||||||
m.quitting = true
|
m.quitting = true
|
||||||
return m, tea.Quit
|
return tea.Quit
|
||||||
case " ", "tab", "x":
|
case " ", "tab", "x":
|
||||||
if m.limit == 1 {
|
if m.limit == 1 {
|
||||||
break // no op
|
break // no op
|
||||||
|
@ -131,7 +124,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
m.inputModel.inputState = INPUT
|
m.inputModel.inputState = INPUT
|
||||||
m.inputModel.input.Focus()
|
m.inputModel.input.Focus()
|
||||||
m.inputModel.input.CharLimit = 30
|
m.inputModel.input.CharLimit = 30
|
||||||
return m, textinput.Blink
|
return textinput.Blink
|
||||||
}
|
}
|
||||||
m.quitting = true
|
m.quitting = true
|
||||||
// If the user hasn't selected any items in a multi-select.
|
// If the user hasn't selected any items in a multi-select.
|
||||||
|
@ -140,7 +133,21 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
if m.numSelected < 1 {
|
if m.numSelected < 1 {
|
||||||
m.items[m.index].selected = true
|
m.items[m.index].selected = true
|
||||||
}
|
}
|
||||||
return m, tea.Quit
|
return tea.Quit
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
|
||||||
|
switch msg := msg.(type) {
|
||||||
|
case tea.WindowSizeMsg:
|
||||||
|
return m, nil
|
||||||
|
|
||||||
|
case tea.KeyMsg:
|
||||||
|
if m.inputModel.inputState == SELECT {
|
||||||
|
if c := m.handleSelectKeys(msg); c != nil {
|
||||||
|
return m, c
|
||||||
}
|
}
|
||||||
} else if m.inputModel.inputState == INPUT {
|
} else if m.inputModel.inputState == INPUT {
|
||||||
switch keypress := msg.String(); keypress {
|
switch keypress := msg.String(); keypress {
|
||||||
|
|
Loading…
Reference in a new issue