One way to avoid the cursor blinking (as suggested) is to temporarily hide the cursor.
However, this is only part of the solution. Your program should also consider this:
- after hiding the cursor and changing the screen to , showing the cursor again move back to the original location.
- hiding / showing the cursor keeps the cursor from blinking significantly when your updates take only a small amount of time. If you are fortunate enough to mix this with some time-consuming process, the cursor will blink.
The proposed solution using setterm not portable; it is specific to the Linux console. And running the executable using system not needed. But even works
system("tput civis"); ... system("tput cnorm");
is an improvement over using setterm .
Checking the source code for wget does not find hiding escape sequences. What you see with the progress bar is that it leaves the cursor in about the same place when it does something time-consuming. The output to the terminal takes so little time that you will not notice a short rewrite of the line (by printing the carriage return, and then writing most of the line again). If it were slower, hiding the cursor would help - to the point.
By the way, this method of hiding the cursor is used in terminal drivers for some editors (vim and vile ).
source share