charmbracelet / charmbracelet/bubbles

Highlighted row in table jumping out of view

Open
#733 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

When I try something like this here https://github.com/charmbracelet/bubbletea/blob/cb6f8402f63d74df566577015ef10a75335eb242/examples/table/main.go#L25

```
case "tab":
m.table.SetCursor(m.table.Cursor() + 9)
```

The highlighted row can jump out of view.

Looking at this, I see a couple things
https://github.com/charmbracelet/bubbles/blob/0f9e38c9a7217bcd3d04b87c725c20047bc6aa64/table/table.go#L344-L362

1. Lines 358 and 360 don't follow the pattern of calling SetYOffset. Probably not a problem, but thought I'd point it out incase it was a mistake
2. `SetCursor` doesn't do this ViewPort clamping. Is this the issue? We can't access viewport from a user API, so it would need to be fixed in the main code.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.