Skip to content

Commit

Permalink
Updates to textarea example
Browse files Browse the repository at this point in the history
Requires wip-branch of bubbles.
  • Loading branch information
muesli committed Feb 21, 2024
1 parent 65424fb commit 75b7683
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/textarea/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
)

func main() {
p := tea.NewProgram(initialModel())
p := tea.NewProgram()
m := initialModel(p.RenderContext())

if _, err := p.Run(); err != nil {
if _, err := p.Run(m); err != nil {
log.Fatal(err)
}
}
Expand All @@ -26,8 +27,8 @@ type model struct {
err error
}

func initialModel() model {
ti := textarea.New()
func initialModel(ctx *tea.Context) model {
ti := textarea.New(ctx.Renderer)
ti.Placeholder = "Once upon a time..."
ti.Focus()

Expand Down

0 comments on commit 75b7683

Please sign in to comment.