mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-28 18:34:36 +00:00
GNU less can display ANSI-colored text with the -R flag, but this support has some limitations. One of them is that if an escape sequence starts on one line and ends on a different line, only the first line will be colored in less. As a result, when diff creates colored output with multi-line deletes or adds, less will only color the first line. This change resets ANSI color to the default at the end of each line and restarts it at the beginning of the next. It patches normal and context mode. Side-by-side already worked in my testing. * src/context.c (print_context_label, pr_context_hunk): As above. (pr_unidiff_hunk, print_context_header): Likewise. * src/normal.c (print_normal_hunk): Likewise. * tests/colors: Adjust existing tests to accommodate this. * NEWS (Improvements): Mention it. Proposed in http://bugs.gnu.org/31105