Skip to content

Commit

Permalink
Add StartInSearchMode (#60)
Browse files Browse the repository at this point in the history
Option to allow select to start in search mode.
  • Loading branch information
j-martin authored and ҈҈҈Luiz Branco committed Feb 2, 2018
1 parent 4baa118 commit 8debffa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Background colors codes and template helpers
- `AllowEdit` for prompt to prevent deletion of the default value by any key
- Added `StartInSearchMode` to allow starting the prompt in search mode

### Fixed

Expand Down
5 changes: 4 additions & 1 deletion select.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type Select struct {
// Searcher can be implemented to teach the select how to search for items.
Searcher list.Searcher

// Starts the prompt in search mode.
StartInSearchMode bool

label string

list *list.List
Expand Down Expand Up @@ -150,7 +153,7 @@ func (s *Select) innerRun(starting int, top rune) (int, string, error) {

var searchInput []rune
canSearch := s.Searcher != nil
searchMode := false
searchMode := s.StartInSearchMode

c.SetListener(func(line []rune, pos int, key rune) ([]rune, int, bool) {
switch {
Expand Down

0 comments on commit 8debffa

Please sign in to comment.