calculate string length based on terminal size