Description
With the default "diff" conflict marker style, the %%%%%%% section of a materialized conflict uses + or - line prefixes to indicate repeats/removals. In a color-words diff of a conflicted file, every repeated line renders as a lone inserted + except the last one, which renders as the line removed and re-added in that order meaning the + prefix ends up in the middle of the line. This means the consistency of the + column prefix is broken for that last line.
From what I can tell, this happens because the region around the last copied line has no token that occurs the same number of times on both sides, so unchanged_ranges() has no anchor and reports the line wholly replaced. It is only visible with color on because the no-color layout prints removed and added lines separately.
Steps to Reproduce the Problem
jj git init repro && cd repro
printf 'start\nend\n' > file
jj commit -m A
printf 'start\n {\n one,\n },\n {\n two,\n },\nend\n' > file
jj commit -m L
jj new 'subject("A")'
printf 'start\n {\n three,\n },\n {\n four,\n },\n {\n five,\n },\nend\n' > file
jj commit -m M
jj rebase -s 'subject("M")' -d 'subject("L")'
jj diff -r 'subject("M")'
(Reproduced on jj 0.43.0 and on main at 6b27ec8)
Expected Behavior
2 5: + {
3 6: + one,
4 7: + },
5 8: + {
6 9: + two,
7 10: + },
11: +++++++ rmnwmpsu 6216c8d6 "M" (rebased revision)
Actual Behavior
2 5: + {
3 6: + one,
4 7: + },
5 8: + {
6 9: + two,
7 10: },+ }, <-- red " }," then green "+ },"
11: +++++++ rmnwmpsu 6216c8d6 "M" (rebased revision)
Specifications
- Platform: macOS
- Version: 0.43.0 and HEAD
Description
With the default "diff" conflict marker style, the %%%%%%% section of a materialized conflict uses
+or-line prefixes to indicate repeats/removals. In acolor-wordsdiff of a conflicted file, every repeated line renders as a lone inserted+except the last one, which renders as the line removed and re-added in that order meaning the+prefix ends up in the middle of the line. This means the consistency of the+column prefix is broken for that last line.From what I can tell, this happens because the region around the last copied line has no token that occurs the same number of times on both sides, so
unchanged_ranges()has no anchor and reports the line wholly replaced. It is only visible with color on because the no-color layout prints removed and added lines separately.Steps to Reproduce the Problem
(Reproduced on jj 0.43.0 and on main at 6b27ec8)
Expected Behavior
Actual Behavior
Specifications