diff --git a/examples/starwars/main.go b/examples/starwars/main.go index 542c2ae..8201cac 100644 --- a/examples/starwars/main.go +++ b/examples/starwars/main.go @@ -290,16 +290,18 @@ func (m model) updateImage() tea.Msg { // updateViewport updates the viewport with the selected character's details. func (m model) updateViewport() { - character := m.characters[m.table.Cursor()] - md, _ := m.renderer.Render( - fmt.Sprintf( - characterTpl, - character.ID, - sanitize(character.Name), - sanitize(character.Description), - ), - ) - m.viewport.SetContent(md) + if m.table.Cursor() > 0 { + character := m.characters[m.table.Cursor()] + md, _ := m.renderer.Render( + fmt.Sprintf( + characterTpl, + character.ID, + sanitize(character.Name), + sanitize(character.Description), + ), + ) + m.viewport.SetContent(md) + } } // setTableRows sets the table rows with the provided character data. diff --git a/examples/starwars/starwars.gif b/examples/starwars/starwars.gif index 809e9ea..19ffc6f 100644 Binary files a/examples/starwars/starwars.gif and b/examples/starwars/starwars.gif differ diff --git a/examples/starwars/starwars.tape b/examples/starwars/starwars.tape index 792f148..bbc3cf4 100644 --- a/examples/starwars/starwars.tape +++ b/examples/starwars/starwars.tape @@ -60,18 +60,19 @@ Output starwars.gif Require echo Set Shell "bash" -Set FontSize 12 +Set FontSize 13 Set Width 1200 Set Height 600 Type "./starwars" -Enter -Sleep 5000ms -Down -Sleep 500ms -Down -Down -Sleep 500ms -Down +Enter@5 +Down@1 +Down@1 +Down@1 +Down@1 +Down@1 +Down@1 +Down@1 +Down@1 +Down@1 -Sleep 5s