Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
muesli marked this conversation as resolved.
Show resolved Hide resolved
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