mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
added test for text view split line
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user