extractLines parses the output buffer and returns lines without ANSI control sequences
(buf *bytes.Buffer)
| 60 | |
| 61 | // extractLines parses the output buffer and returns lines without ANSI control sequences |
| 62 | func extractLines(buf *bytes.Buffer) []string { |
| 63 | content := buf.String() |
| 64 | // Split by newline |
| 65 | rawLines := strings.Split(content, "\n") |
| 66 | var lines []string |
| 67 | for _, line := range rawLines { |
| 68 | // Skip empty lines and lines that are just ANSI codes |
| 69 | if lenAnsi(line) > 0 { |
| 70 | lines = append(lines, line) |
| 71 | } |
| 72 | } |
| 73 | return lines |
| 74 | } |
| 75 | |
| 76 | func TestPrintWithDimensions_LinesFitTerminalWidth(t *testing.T) { |
| 77 | testCases := []struct { |
no test coverage detected