forked from Mirrors/bubbletea
Add a border to the Glamour example per the viewport API update
This commit is contained in:
parent
7514ac937a
commit
7517c1b1bd
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue