From d3a10663bd6d7698ad2d05baceb1593c032d013b Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Thu, 4 Apr 2024 16:21:56 +0200 Subject: [PATCH] balloons work better than the old spinner --- src/org/rascalmpl/repl/TerminalProgressBarMonitor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/org/rascalmpl/repl/TerminalProgressBarMonitor.java b/src/org/rascalmpl/repl/TerminalProgressBarMonitor.java index 4d4749bb09a..cc605941d2b 100644 --- a/src/org/rascalmpl/repl/TerminalProgressBarMonitor.java +++ b/src/org/rascalmpl/repl/TerminalProgressBarMonitor.java @@ -138,9 +138,14 @@ private class ProgressBar { private final Instant startTime; private Duration duration; private String message = ""; + + /** + * Stepper is incremented with every jobStep that has an visible effect on the progress bar. + * It is used to index into `clocks` or `twister` to create an animation effect. + */ private int stepper = 1; private final String[] clocks = new String[] {"🕐" , "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕛"}; - private final String[] twister = new String[] {"|" , "/", "-", "\\", "|", "/", "-", "\\"}; + private final String[] twister = new String[] {"." , ".", "o", "o", "O","O", "O", "o", "o", ".", "."}; public int nesting = 0; ProgressBar(String name, int max) { @@ -154,7 +159,7 @@ private class ProgressBar { } void worked(int amount, String message) { - this.current += Math.min(amount, max); + this.current = Math.min(current + amount, max); this.duration = Duration.between(startTime, Instant.now()); this.message = message; }