simplify a bit
Vladimir Bauer
9 years ago
| 52 | 52 | func (w *Writer) clearLines() { |
| 53 | 53 | f, ok := w.out.(FdWriter) |
| 54 | 54 | if ok && !isatty.IsTerminal(f.Fd()) { |
| 55 | ok = false | |
| 56 | } | |
| 57 | if !ok { | |
| 58 | 55 | for i := 0; i < w.lineCount; i++ { |
| 59 | 56 | fmt.Fprintf(w.out, "%c[%dA", ESC, 0) // move the cursor up |
| 60 | 57 | fmt.Fprintf(w.out, "%c[2K\r", ESC) // clear the line |