I'm trying to understand the source code from a gist (Console progress bar by DanielSWolf).
He wrote this to show a progress bar in the console while doing some work in the background.
Ripped off his SO answer here.
There is a line of code which I do not understand (row 68):
// If the new text is shorter than the old one: delete overlapping characters
int overlapCount = currentText.Length - text.Length;
if (overlapCount > 0) {
outputBuilder.Append(' ', overlapCount);
outputBuilder.Append('\b', overlapCount);
}
This code is called by his timer handler (which is called each timer tick).
I can't find a purpose for keeping those 5 lines code.
Is this a prevention for a console display bug?