mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-15 01:13:22 +00:00
fix: do not scroll if width is 0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
@@ -152,7 +152,7 @@ func (m Model) visibleLines() (lines []string) {
|
||||
lines = m.lines[top:bottom]
|
||||
}
|
||||
|
||||
if m.xOffset == 0 && m.longestLineWidth <= m.Width {
|
||||
if (m.xOffset == 0 && m.longestLineWidth <= m.Width) || m.Width == 0 {
|
||||
return lines
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ func TestVisibleLines(t *testing.T) {
|
||||
numberOfLines := 10
|
||||
|
||||
m := New(10, numberOfLines)
|
||||
m.lines = defaultList
|
||||
m.SetContent(strings.Join(defaultList, "\n"))
|
||||
|
||||
list := m.visibleLines()
|
||||
if len(list) != numberOfLines {
|
||||
@@ -228,7 +228,7 @@ func TestVisibleLines(t *testing.T) {
|
||||
numberOfLines := 10
|
||||
|
||||
m := New(10, numberOfLines)
|
||||
m.lines = defaultList
|
||||
m.SetContent(strings.Join(defaultList, "\n"))
|
||||
m.YOffset = 5
|
||||
|
||||
list := m.visibleLines()
|
||||
|
||||
Reference in New Issue
Block a user