Skip to content
Myr

docs(example): set wordwrap in glamour example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent 989d49f · Browse files · 1 file+7 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−6 removed

  • other:+7 added−6 removed

1 file+7 added−6 removed

modified:examples/glamour/main.go+7 added-6 removed
53 unmodified lines
54 viewport viewport.Model55}5657func newExample() (*example, error) {58 const width = 785958 vp := viewport.New(78, 20)60 vp := viewport.New(width, 20)61 vp.Style = lipgloss.NewStyle().62 BorderStyle(lipgloss.RoundedBorder()).63 BorderForeground(lipgloss.Color("62")).64 PaddingRight(2)6564 renderer, err := glamour.NewTermRenderer(glamour.WithStylePath("notty"))66 renderer, err := glamour.NewTermRenderer(67 glamour.WithStylePath("notty"),68 glamour.WithWordWrap(width),69 )70 if err != nil {71 return nil, err72 }73
14 unmodified lines
88}8990func (e example) Update(msg tea.Msg) (tea.Model, tea.Cmd) {91 switch msg := msg.(type) {87 case tea.WindowSizeMsg:88 e.viewport.Width = msg.Width89 return e, nil9092 case tea.KeyMsg:93 switch msg.String() {94 case "q", "ctrl+c", "esc":95 return e, tea.Quit
30 unmodified lines