fix(list): DisableQuitKeybinding is ignored after updating the list (#108)

This commit is contained in:
Ayman Bagabas 2022-01-27 13:09:53 -05:00 committed by GitHub
parent db97ac515d
commit 18d25458da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
@ -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)
@ -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)
@ -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.