Unable to get terminal window size when ioctl fails
We currently rely on ioctl()
working to get the terminal window size. This can fail, in which case we should fall back to getting the window size by positioning the cursor at the bottom right of the screen and reading the control characters from stdin.