truncateDetails tries to truncate the first line's details to reduce overflow. Returns true if any truncation was performed.
(lines []lineData, overflow int)
| 506 | // truncateDetails tries to truncate the first line's details to reduce overflow. |
| 507 | // Returns true if any truncation was performed. |
| 508 | func truncateDetails(lines []lineData, overflow int) bool { |
| 509 | for i := range lines { |
| 510 | l := &lines[i] |
| 511 | if len(l.details) > 3 { |
| 512 | reduction := min(overflow, len(l.details)-3) |
| 513 | l.details = l.details[:len(l.details)-reduction-3] + "..." |
| 514 | return true |
| 515 | } else if l.details != "" { |
| 516 | l.details = "" |
| 517 | return true |
| 518 | } |
| 519 | } |
| 520 | return false |
| 521 | } |
| 522 | |
| 523 | // truncateLongestTaskID truncates the longest taskID to reduce overflow. |
| 524 | // Returns true if truncation was performed. Lengths and slicing are in runes |