added test for text view split line

This commit is contained in:
Peter Reisinger
2017-12-01 15:51:55 +00:00
parent bd8940ae0a
commit d0b5c6c854
2 changed files with 40 additions and 2 deletions

View File

@@ -93,14 +93,17 @@ func (t *TextView) readInputLoop() {
}
func splitLine(line string, lineSize int) []string {
if line == "" {
return []string{}
}
var lines []string
for {
if len(line) < lineSize {
if len(line) <= lineSize {
lines = append(lines, line)
return lines
}
lines = append(lines, line[:lineSize])
line = line[lineSize:]
}
return lines
}