Lines that are longer than the terminal width are not handled correctly in the terminal pager, which assumes they are just one line when written to the terminal whereas they will actually be more than one. This will need a calculation of the length of each line, ignoring ansi color codes.