From 45ea5f636b16ec8c5e9f71fc9d6e2d4413fcd345 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 27 Jan 2022 13:09:53 -0500 Subject: [PATCH] fix(list): DisableQuitKeybinding is ignored after updating the list (#108) --- list/list.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/list/list.go b/list/list.go index ec331707..e52552d2 100644 --- a/list/list.go +++ b/list/list.go @@ -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.