mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-14 08:58:32 +00:00
perf: do not cut anything if not needed
This commit is contained in:
@@ -139,6 +139,10 @@ func (m Model) visibleLines() (lines []string) {
|
||||
lines = m.lines[top:bottom]
|
||||
}
|
||||
|
||||
if m.xOffset == 0 && m.longestLineWidth <= m.Width {
|
||||
return lines
|
||||
}
|
||||
|
||||
cutLines := make([]string, len(lines))
|
||||
for i := range lines {
|
||||
cutLines[i] = ansi.Cut(lines[i], m.xOffset, m.xOffset+m.Width)
|
||||
|
||||
Reference in New Issue
Block a user