Add a border to the Glamour example per the viewport API update

This commit is contained in:
Christian Rocha 2021-09-02 16:18:51 -04:00
parent 7514ac937a
commit 7517c1b1bd
1 changed files with 7 additions and 3 deletions

View File

@ -55,7 +55,11 @@ type example struct {
}
func newExample() (*example, error) {
vp := viewport.NewModel(78, 20)
vp := viewport.New(78, 20)
vp.Style = lipgloss.NewStyle().
BorderStyle(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("62")).
PaddingRight(2)
renderer, err := glamour.NewTermRenderer(glamour.WithStylePath("notty"))
if err != nil {
@ -89,8 +93,8 @@ func (e example) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "q", "ctrl+c", "esc":
return e, tea.Quit
default:
newModel, cmd := e.viewport.Update(msg)
e.viewport = newModel.(viewport.Model)
var cmd tea.Cmd
e.viewport, cmd = e.viewport.Update(msg)
return e, cmd
}
default: