Check the length of the buffer against the number of columns in the terminal. If the buffer is too long, set it to the terminal width.
buffer to check the length of
the truncated buffer
See Implementation
Check the length of the buffer against the number of columns in the terminal. If the buffer is too long, set it to the terminal width.