Skip to content

Commit

Permalink
fix(list): DisableQuitKeybinding is ignored after updating the list
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Jan 26, 2022
1 parent db97ac5 commit 1e1f8d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ func (m Model) itemsAsFilterItems() filteredItems {

// Set keybindings according to the filter state.
func (m *Model) updateKeybindings() {
quit := m.KeyMap.Quit.Enabled()
switch m.filterState {
case Filtering:
m.KeyMap.CursorUp.SetEnabled(false)
Expand All @@ -602,7 +603,7 @@ func (m *Model) updateKeybindings() {
m.KeyMap.ClearFilter.SetEnabled(false)
m.KeyMap.CancelWhileFiltering.SetEnabled(true)
m.KeyMap.AcceptWhileFiltering.SetEnabled(m.FilterInput.Value() != "")
m.KeyMap.Quit.SetEnabled(true)
m.KeyMap.Quit.SetEnabled(false)
m.KeyMap.ShowFullHelp.SetEnabled(false)
m.KeyMap.CloseFullHelp.SetEnabled(false)

Expand All @@ -622,7 +623,6 @@ func (m *Model) updateKeybindings() {
m.KeyMap.ClearFilter.SetEnabled(m.filterState == FilterApplied)
m.KeyMap.CancelWhileFiltering.SetEnabled(false)
m.KeyMap.AcceptWhileFiltering.SetEnabled(false)
m.KeyMap.Quit.SetEnabled(true)

if m.Help.ShowAll {
m.KeyMap.ShowFullHelp.SetEnabled(true)
Expand All @@ -633,6 +633,7 @@ func (m *Model) updateKeybindings() {
m.KeyMap.CloseFullHelp.SetEnabled(minHelp)
}
}
m.KeyMap.Quit.SetEnabled(quit)
}

// Update pagination according to the amount of items for the current state.
Expand Down

0 comments on commit 1e1f8d8

Please sign in to comment.