charmbracelet / charmbracelet/bubbles

Viewport ScrollPercent() sometimes returns `NaN`

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

Description

if `y.Offset` = 0 and the terminal window size is **almost large enough** to contain all of the content in the viewport, `ScrollPercent()` will return `NaN`.

If the `m.Height >= len(m.lines)` your already returning 1.0 which works great, maybe it should be len(m.lines - 1) because you also have `t := float64(len(m.lines) - 1)`? Not sure yet, I haven't debugged it yet, but you can see it here in the default bubbletea/examples/pager`.

![image](https://user-images.githubusercontent.com/11534217/200468420-7ef8d9c2-dfb2-4e08-9443-663a34dfad02.png)

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.