correct barWidth
Vladimir Bauer
9 years ago
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | totalCount := prependCount + barCount + appendCount |
| 429 | if totalCount >= termWidth { | |
| 430 | newWidth := termWidth - prependCount - appendCount - 1 | |
| 429 | if totalCount > termWidth { | |
| 430 | newWidth := termWidth - prependCount - appendCount | |
| 431 | 431 | barBlock = s.fillBar(newWidth) |
| 432 | 432 | } |
| 433 | 433 | |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // bar width without leftEnd and rightEnd characters |
| 448 | barWidth := width - 2 | |
| 448 | barWidth := width - 1 | |
| 449 | 449 | formatBytes := s.convertFormatRunesToBytes() |
| 450 | 450 | |
| 451 | 451 | if s.simpleSpinner != nil { |
| 481 | 481 | } |
| 482 | 482 | // set tip bit |
| 483 | 483 | if completedWidth > 0 && completedWidth < barWidth { |
| 484 | // buf[completedWidth-1] = s.tip | |
| 485 | 484 | buf = append(buf, formatBytes[2]...) |
| 486 | 485 | } |
| 487 | 486 | |