Update viewport/viewport.go

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Roman
2024-12-18 19:40:01 +01:00
committed by GitHub
co-authored by Carlos Alexandro Becker
parent 143ea4305b
commit f1307e54de
+7 -8
View File
@@ -134,16 +134,15 @@ func (m Model) visibleLines() (lines []string) {
lines = m.lines[top:bottom]
}
if m.indent > 0 {
cutLines := make([]string, len(lines))
for i := range lines {
cutLines[i] = ansi.TruncateLeft(lines[i], m.indent, "")
cutLines := make([]string, len(lines))
for i, line := range lines {
if m.indent > 0 {
line = ansi.TruncateLeft(line, m.indent, "")
}
return cutLines
line = ansi.Truncate(line, m.Width, "")
cutLines[i] = line
}
return lines
return cutLines
}
// scrollArea returns the scrollable boundaries for high performance rendering.