Fix a FPS counter bug when the value goes over 5 digits

The problem was that the code assumed a certain maximum number of digits
for the FPS.  In certain situations, seems to be possible to exceed this
number, so let's "generalize" the line cleanup by remembering how many
characters where printed.