Turns out you simply forgot to add width of the last character plus 2 - I copied that from the original implementation of reserve_free_space. Also, a name like this.allocated_space would be more appropriate instead of this.free_space from my understanding of the code.
Well, since it should point to the first free space available (which is after all the allocated space), I find free_space to be appropriate.
Anyway, good catch, thanks for finding out the problem.
Turns out you simply forgot to add width of the last character plus 2 - I copied that from the original implementation of
reserve_free_space
. Also, a name likethis.allocated_space
would be more appropriate instead ofthis.free_space
from my understanding of the code.