dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.34k stars 359 forks source link

Stop highlighting unchanged whitespace #1659

Closed phillipwood closed 3 months ago

phillipwood commented 3 months ago

Fix a regression introduced by feec45b (Fix warning highlight for trailing whitespace (#1037), 2023-05-17) where trailing space at the end of an unchanged token is highlighted if the token follows an insertion. This happens because when the token is split in two to separate trailing whitespace the two halves end up being tagged with different edit operations. This can be seen in the test changes in test_infer_edits_14 and test_infer_edits_16 introduced by feec45b which changed the operation from PlusNoop to Insertion when splitting trailing whitespace from unchanged tokens. Fix this by using the same operation when adding both halves of a split token and correcting the tests.

Fixes #1658

dandavison commented 3 months ago

Excellent, thanks very much again @phillipwood.