ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.08k stars 103 forks source link

progress bar looks strange #138

Closed earlyou closed 2 years ago

earlyou commented 2 years ago

progress bar error

HI, I'm currently using Eclipse and the bar looks strange. I wonder if there is no \rmethod. And the bar constantly changes its shape.

here is my example codes

try (ProgressBar pb1 = new ProgressBar("Interting", totalCount)) {
     if (condition) {
          for (int i = 0; i < numofrows; i++) {
               pb1.step();
               // ...
          }
     }else{
          for (int i = 0; i < totalpage-1; i++) {
               for (int j = 0; j < numofrows; j++) {
                    pb1.step();
                    // ...
               }
          }
     }
     pb1.close();
}
ProgressBar pb1 = new ProgressBar("Inserting", totalCount);
if (condition) {
     for (int i = 0; i < numofrows; i++) {
          pb1.step();
          // ...
     }
}else{
     for (int i = 0; i < totalpage-1; i++) {
          for (int j = 0; j < numofrows; j++) {
               pb1.step();
               // ...
          }
     }
}
pb1.close();

am i using it right? both results are the same

+++++ progress bar linux I uploaded my project to Linux CentOs 7 Server and the progress bar works just fine

Is it only me bar working weird on Eclipse?

ctongfei commented 2 years ago

Your terminal in Eclipse does not seem to support ANSI support symbols. You can use ProgressBarStyle.ASCII to remove some of these weird fonts. This is a problem of Eclipse.

As for your Linux Server, the block can be removed by changing your terminal font (Courier New does not have full support for these symbols).

earlyou commented 2 years ago

Thanks for your reply. By the way your project is awesome :)