Calculate space for indentation

Hi Jonathan!
I've tried to make an universal solution for #27 and write some code here. Looking forward for your review!