We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
Using the arrow keys kills the example app.
Setup Please complete the following information along with version numbers, if applicable.
To Reproduce
Source Code
A simpler version of the example code
package main import ( "fmt" "log" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" ) func main() { p := tea.NewProgram(initialModel()) if _, err := p.Run(); err != nil { log.Fatal(err) } } type gotReposSuccessMsg []repo type gotReposErrMsg error type repo struct { Name string } func getRepos() tea.Msg { var repos []repo repos = append(repos, repo{"foo"}) repos = append(repos, repo{"bar"}) return gotReposSuccessMsg(repos) } type model struct { textInput textinput.Model } func initialModel() model { ti := textinput.New() ti.Placeholder = "repository" ti.Prompt = "charmbracelet/" ti.PromptStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("63")) ti.Cursor.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("63")) ti.Focus() ti.CharLimit = 50 ti.Width = 20 ti.ShowSuggestions = true return model{textInput: ti} } func (m model) Init() tea.Cmd { return tea.Batch(getRepos, textinput.Blink) } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.KeyMsg: switch msg.Type { case tea.KeyEnter, tea.KeyCtrlC, tea.KeyEsc: return m, tea.Quit } case gotReposSuccessMsg: var suggestions []string for _, r := range msg { suggestions = append(suggestions, r.Name) } m.textInput.SetSuggestions(suggestions) } var cmd tea.Cmd m.textInput, cmd = m.textInput.Update(msg) return m, cmd } func (m model) View() string { return fmt.Sprintf( "repo: %s\n", m.textInput.View(), ) }
Expected behavior
The arrow keys should navigate within the suggestions and certainly not exit the program.
Screenshots
Additional context
Maybe I am just holding it wrong - but then it feels like this should be more obvious.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Using the arrow keys kills the example app.
Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Source Code
A simpler version of the example code
Expected behavior
The arrow keys should navigate within the suggestions and certainly not exit the program.
Screenshots
Additional context
Maybe I am just holding it wrong - but then it feels like this should be more obvious.
The text was updated successfully, but these errors were encountered: