Skip to content

Commit

Permalink
Merge pull request #519 from pterm/517-if-withfilter-is-enabled-and-y…
Browse files Browse the repository at this point in the history
…ou-try-to-set-a-custom-key-multiselect-immediately-exits
  • Loading branch information
MarvinJWendt committed Jun 3, 2023
2 parents e347673 + e075e5c commit c7e0db2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion interactive_multiselect_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ type InteractiveMultiselectPrinter struct {
displayedOptionsStart int
displayedOptionsEnd int

KeySelect keys.KeyCode
// KeySelect is the select key. It cannot be keys.Space when Filter is enabled.
KeySelect keys.KeyCode

// KeyConfirm is the confirm key. It cannot be keys.Space when Filter is enabled.
KeyConfirm keys.KeyCode
}

Expand Down Expand Up @@ -87,12 +90,14 @@ func (p InteractiveMultiselectPrinter) WithFilter(filter bool) *InteractiveMulti
}

// WithKeySelect sets the confirm key
// It cannot be keys.Space when Filter is enabled.
func (p InteractiveMultiselectPrinter) WithKeySelect(keySelect keys.KeyCode) *InteractiveMultiselectPrinter {
p.KeySelect = keySelect
return &p
}

// WithKeyConfirm sets the confirm key
// It cannot be keys.Space when Filter is enabled.
func (p InteractiveMultiselectPrinter) WithKeyConfirm(keyConfirm keys.KeyCode) *InteractiveMultiselectPrinter {
p.KeyConfirm = keyConfirm
return &p
Expand Down

0 comments on commit c7e0db2

Please sign in to comment.