@pierre/diffs 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -741,6 +741,39 @@ function getExpandedRegion({ isPartial, rangeSize, expandedHunks, hunkIndex, col
741
741
  renderAll
742
742
  };
743
743
  }
744
+ function getTrailingContextRangeSize({ fileDiff, errorPrefix }) {
745
+ const lastHunk = fileDiff.hunks[fileDiff.hunks.length - 1];
746
+ if (lastHunk == null || fileDiff.isPartial || fileDiff.additionLines.length === 0 || fileDiff.deletionLines.length === 0) return 0;
747
+ const additionRemaining = fileDiff.additionLines.length - (lastHunk.additionLineIndex + lastHunk.additionCount);
748
+ const deletionRemaining = fileDiff.deletionLines.length - (lastHunk.deletionLineIndex + lastHunk.deletionCount);
749
+ if (additionRemaining <= 0 && deletionRemaining <= 0) return 0;
750
+ if (additionRemaining !== deletionRemaining) throw new Error(`${errorPrefix}: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${fileDiff.name}`);
751
+ return Math.min(additionRemaining, deletionRemaining);
752
+ }
753
+ function getTrailingExpandedRegion({ fileDiff, hunkIndex, expandedHunks, collapsedContextThreshold, errorPrefix }) {
754
+ if (hunkIndex !== fileDiff.hunks.length - 1) return;
755
+ const trailingRangeSize = getTrailingContextRangeSize({
756
+ fileDiff,
757
+ errorPrefix
758
+ });
759
+ if (trailingRangeSize <= 0) return;
760
+ if (expandedHunks === true || trailingRangeSize <= collapsedContextThreshold) return {
761
+ fromStart: trailingRangeSize,
762
+ fromEnd: 0,
763
+ rangeSize: trailingRangeSize,
764
+ collapsedLines: 0,
765
+ renderAll: true
766
+ };
767
+ const region = expandedHunks?.get(fileDiff.hunks.length);
768
+ const fromStart = Math.min(Math.max(region?.fromStart ?? 0, 0), trailingRangeSize);
769
+ return {
770
+ fromStart,
771
+ fromEnd: 0,
772
+ rangeSize: trailingRangeSize,
773
+ collapsedLines: trailingRangeSize - fromStart,
774
+ renderAll: fromStart >= trailingRangeSize
775
+ };
776
+ }
744
777
 
745
778
  //#endregion
746
779
  //#region src/utils/iterateOverDiff.ts
@@ -753,12 +786,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
753
786
  collapsedContextThreshold
754
787
  });
755
788
  const state = {
756
- finalHunk: diff.hunks.at(-1),
757
789
  viewportStart: startingLine,
758
790
  viewportEnd: startingLine + totalLines,
759
791
  isWindowedHighlight: startingLine > 0 || totalLines < Infinity,
760
792
  splitCount: iterationStart.splitCount,
761
793
  unifiedCount: iterationStart.unifiedCount,
794
+ finalHunkIndex: diff.hunks.length - 1,
762
795
  shouldBreak() {
763
796
  if (!state.isWindowedHighlight) return false;
764
797
  const breakUnified = state.unifiedCount >= startingLine + totalLines;
@@ -811,31 +844,24 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
811
844
  hunkIndex,
812
845
  collapsedContextThreshold
813
846
  });
814
- const trailingRegion = (() => {
815
- if (hunk !== state.finalHunk || !hasFinalCollapsedHunk(diff)) return;
816
- const additionRemaining = diff.additionLines.length - (hunk.additionLineIndex + hunk.additionCount);
817
- const deletionRemaining = diff.deletionLines.length - (hunk.deletionLineIndex + hunk.deletionCount);
818
- if (additionRemaining !== deletionRemaining) throw new Error(`iterateOverDiff: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${diff.name}`);
819
- const trailingRangeSize = Math.min(additionRemaining, deletionRemaining);
820
- return getExpandedRegion({
821
- isPartial: diff.isPartial,
822
- rangeSize: trailingRangeSize,
823
- expandedHunks,
824
- hunkIndex: diff.hunks.length,
825
- collapsedContextThreshold
826
- });
827
- })();
847
+ const trailingRegion = hunkIndex === state.finalHunkIndex ? getTrailingExpandedRegion({
848
+ fileDiff: diff,
849
+ hunkIndex,
850
+ expandedHunks,
851
+ collapsedContextThreshold,
852
+ errorPrefix: "iterateOverDiff"
853
+ }) : void 0;
828
854
  const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
829
855
  function getTrailingCollapsedAfter(unifiedLineIndex$1, splitLineIndex$1) {
830
856
  if (trailingRegion == null || trailingRegion.collapsedLines <= 0 || trailingRegion.fromStart + trailingRegion.fromEnd > 0) return 0;
831
857
  if (diffStyle === "unified") return unifiedLineIndex$1 === hunk.unifiedLineStart + hunk.unifiedLineCount - 1 ? trailingRegion.collapsedLines : 0;
832
858
  return splitLineIndex$1 === hunk.splitLineStart + hunk.splitLineCount - 1 ? trailingRegion.collapsedLines : 0;
833
859
  }
834
- function getPendingCollapsed() {
835
- if (leadingRegion.collapsedLines === 0) return 0;
836
- const value = leadingRegion.collapsedLines;
837
- leadingRegion.collapsedLines = 0;
838
- return value;
860
+ let consumedCollapsed = leadingRegion.collapsedLines === 0;
861
+ function consumePendingCollapsed() {
862
+ if (consumedCollapsed) return 0;
863
+ consumedCollapsed = true;
864
+ return leadingRegion.collapsedLines;
839
865
  }
840
866
  if (!state.shouldSkip(expandedLineCount, expandedLineCount)) {
841
867
  let unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.rangeSize;
@@ -844,81 +870,63 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
844
870
  let additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.rangeSize;
845
871
  let deletionLineNumber$1 = hunk.deletionStart - leadingRegion.rangeSize;
846
872
  let additionLineNumber$1 = hunk.additionStart - leadingRegion.rangeSize;
847
- const [startIndex, endIndex] = getEqualLineIterationRange(state, leadingRegion.fromStart, diffStyle);
848
- if (startIndex > 0) state.incrementCounts(startIndex, startIndex);
849
- let index = startIndex;
850
- while (index < leadingRegion.fromStart) {
851
- if (index >= endIndex) {
852
- state.incrementCounts(leadingRegion.fromStart - index, leadingRegion.fromStart - index);
853
- break;
854
- }
855
- if (state.isInWindow(0, 0)) {
856
- if (state.emit({
857
- hunkIndex,
858
- hunk,
859
- collapsedBefore: 0,
860
- collapsedAfter: 0,
861
- type: "context-expanded",
862
- deletionLine: {
863
- lineNumber: deletionLineNumber$1 + index,
864
- lineIndex: deletionLineIndex$1 + index,
865
- noEOFCR: false,
866
- unifiedLineIndex: unifiedLineIndex$1 + index,
867
- splitLineIndex: splitLineIndex$1 + index
868
- },
869
- additionLine: {
870
- unifiedLineIndex: unifiedLineIndex$1 + index,
871
- splitLineIndex: splitLineIndex$1 + index,
872
- lineIndex: additionLineIndex$1 + index,
873
- lineNumber: additionLineNumber$1 + index,
874
- noEOFCR: false
875
- }
876
- })) break hunkIterator;
877
- } else state.incrementCounts(1, 1);
878
- index++;
879
- }
873
+ if (walkContextLines(state, leadingRegion.fromStart, diffStyle, (index) => {
874
+ return state.emit({
875
+ hunkIndex,
876
+ hunk,
877
+ collapsedBefore: 0,
878
+ collapsedAfter: 0,
879
+ type: "context-expanded",
880
+ deletionLine: {
881
+ lineNumber: deletionLineNumber$1 + index,
882
+ lineIndex: deletionLineIndex$1 + index,
883
+ noEOFCR: false,
884
+ unifiedLineIndex: unifiedLineIndex$1 + index,
885
+ splitLineIndex: splitLineIndex$1 + index
886
+ },
887
+ additionLine: {
888
+ unifiedLineIndex: unifiedLineIndex$1 + index,
889
+ splitLineIndex: splitLineIndex$1 + index,
890
+ lineIndex: additionLineIndex$1 + index,
891
+ lineNumber: additionLineNumber$1 + index,
892
+ noEOFCR: false
893
+ }
894
+ });
895
+ })) break hunkIterator;
880
896
  unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.fromEnd;
881
897
  splitLineIndex$1 = hunk.splitLineStart - leadingRegion.fromEnd;
882
898
  deletionLineIndex$1 = hunk.deletionLineIndex - leadingRegion.fromEnd;
883
899
  additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.fromEnd;
884
900
  deletionLineNumber$1 = hunk.deletionStart - leadingRegion.fromEnd;
885
901
  additionLineNumber$1 = hunk.additionStart - leadingRegion.fromEnd;
886
- const [fromEndStartIndex, fromEndEndIndex] = getEqualLineIterationRange(state, leadingRegion.fromEnd, diffStyle);
887
- if (fromEndStartIndex > 0) state.incrementCounts(fromEndStartIndex, fromEndStartIndex);
888
- index = fromEndStartIndex;
889
- while (index < leadingRegion.fromEnd) {
890
- if (index >= fromEndEndIndex) {
891
- state.incrementCounts(leadingRegion.fromEnd - index, leadingRegion.fromEnd - index);
892
- break;
893
- }
894
- if (state.isInWindow(0, 0)) {
895
- if (state.emit({
896
- hunkIndex,
897
- hunk,
898
- collapsedBefore: getPendingCollapsed(),
899
- collapsedAfter: 0,
900
- type: "context-expanded",
901
- deletionLine: {
902
- lineNumber: deletionLineNumber$1 + index,
903
- lineIndex: deletionLineIndex$1 + index,
904
- noEOFCR: false,
905
- unifiedLineIndex: unifiedLineIndex$1 + index,
906
- splitLineIndex: splitLineIndex$1 + index
907
- },
908
- additionLine: {
909
- unifiedLineIndex: unifiedLineIndex$1 + index,
910
- splitLineIndex: splitLineIndex$1 + index,
911
- lineIndex: additionLineIndex$1 + index,
912
- lineNumber: additionLineNumber$1 + index,
913
- noEOFCR: false
914
- }
915
- })) break hunkIterator;
916
- } else state.incrementCounts(1, 1);
917
- index++;
918
- }
902
+ if (walkContextLines(state, leadingRegion.fromEnd, diffStyle, (index) => {
903
+ return state.emit({
904
+ hunkIndex,
905
+ hunk,
906
+ collapsedBefore: consumePendingCollapsed(),
907
+ collapsedAfter: 0,
908
+ type: "context-expanded",
909
+ deletionLine: {
910
+ lineNumber: deletionLineNumber$1 + index,
911
+ lineIndex: deletionLineIndex$1 + index,
912
+ noEOFCR: false,
913
+ unifiedLineIndex: unifiedLineIndex$1 + index,
914
+ splitLineIndex: splitLineIndex$1 + index
915
+ },
916
+ additionLine: {
917
+ unifiedLineIndex: unifiedLineIndex$1 + index,
918
+ splitLineIndex: splitLineIndex$1 + index,
919
+ lineIndex: additionLineIndex$1 + index,
920
+ lineNumber: additionLineNumber$1 + index,
921
+ noEOFCR: false
922
+ }
923
+ });
924
+ }, () => {
925
+ consumePendingCollapsed();
926
+ })) break hunkIterator;
919
927
  } else {
920
928
  state.incrementCounts(expandedLineCount, expandedLineCount);
921
- getPendingCollapsed();
929
+ consumePendingCollapsed();
922
930
  }
923
931
  let unifiedLineIndex = hunk.unifiedLineStart;
924
932
  let splitLineIndex = hunk.splitLineStart;
@@ -932,45 +940,37 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
932
940
  const isLastContent = content === lastContent;
933
941
  if (content.type === "context") {
934
942
  if (!state.shouldSkip(content.lines, content.lines)) {
935
- const [startIndex, endIndex] = getEqualLineIterationRange(state, content.lines, diffStyle);
936
- if (startIndex > 0) state.incrementCounts(startIndex, startIndex);
937
- let index = startIndex;
938
- while (index < content.lines) {
939
- if (index >= endIndex) {
940
- state.incrementCounts(content.lines - index, content.lines - index);
941
- break;
942
- }
943
- if (state.isInWindow(0, 0)) {
944
- const isLastLine = isLastContent && index === content.lines - 1;
945
- const unifiedRowIndex = unifiedLineIndex + index;
946
- const splitRowIndex = splitLineIndex + index;
947
- if (state.emit({
948
- hunkIndex,
949
- hunk,
950
- collapsedBefore: getPendingCollapsed(),
951
- collapsedAfter: getTrailingCollapsedAfter(unifiedRowIndex, splitRowIndex),
952
- type: "context",
953
- deletionLine: {
954
- lineNumber: deletionLineNumber + index,
955
- lineIndex: deletionLineIndex + index,
956
- noEOFCR: isLastLine && hunk.noEOFCRDeletions,
957
- unifiedLineIndex: unifiedRowIndex,
958
- splitLineIndex: splitRowIndex
959
- },
960
- additionLine: {
961
- unifiedLineIndex: unifiedRowIndex,
962
- splitLineIndex: splitRowIndex,
963
- lineIndex: additionLineIndex + index,
964
- lineNumber: additionLineNumber + index,
965
- noEOFCR: isLastLine && hunk.noEOFCRAdditions
966
- }
967
- })) break hunkIterator;
968
- } else state.incrementCounts(1, 1);
969
- index++;
970
- }
943
+ if (walkContextLines(state, content.lines, diffStyle, (index) => {
944
+ const isLastLine = isLastContent && index === content.lines - 1;
945
+ const unifiedRowIndex = unifiedLineIndex + index;
946
+ const splitRowIndex = splitLineIndex + index;
947
+ return state.emit({
948
+ hunkIndex,
949
+ hunk,
950
+ collapsedBefore: consumePendingCollapsed(),
951
+ collapsedAfter: getTrailingCollapsedAfter(unifiedRowIndex, splitRowIndex),
952
+ type: "context",
953
+ deletionLine: {
954
+ lineNumber: deletionLineNumber + index,
955
+ lineIndex: deletionLineIndex + index,
956
+ noEOFCR: isLastLine && hunk.noEOFCRDeletions,
957
+ unifiedLineIndex: unifiedRowIndex,
958
+ splitLineIndex: splitRowIndex
959
+ },
960
+ additionLine: {
961
+ unifiedLineIndex: unifiedRowIndex,
962
+ splitLineIndex: splitRowIndex,
963
+ lineIndex: additionLineIndex + index,
964
+ lineNumber: additionLineNumber + index,
965
+ noEOFCR: isLastLine && hunk.noEOFCRAdditions
966
+ }
967
+ });
968
+ }, () => {
969
+ consumePendingCollapsed();
970
+ })) break hunkIterator;
971
971
  } else {
972
972
  state.incrementCounts(content.lines, content.lines);
973
- getPendingCollapsed();
973
+ consumePendingCollapsed();
974
974
  }
975
975
  unifiedLineIndex += content.lines;
976
976
  splitLineIndex += content.lines;
@@ -983,12 +983,13 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
983
983
  const unifiedCount = content.deletions + content.additions;
984
984
  if (!state.shouldSkip(unifiedCount, splitCount)) {
985
985
  const iterationRanges = getChangeIterationRanges(state, content, diffStyle);
986
+ if ((iterationRanges[0]?.[0] ?? 0) > 0) consumePendingCollapsed();
986
987
  for (const [rangeStart, rangeEnd] of iterationRanges) for (let index = rangeStart; index < rangeEnd; index++) {
987
988
  const collapsedAfter = getTrailingCollapsedAfter(unifiedLineIndex + index, diffStyle === "unified" ? splitLineIndex + (index < content.deletions ? index : index - content.deletions) : splitLineIndex + index);
988
989
  if (state.emit(getChangeLineData({
989
990
  hunkIndex,
990
991
  hunk,
991
- collapsedBefore: getPendingCollapsed(),
992
+ collapsedBefore: consumePendingCollapsed(),
992
993
  collapsedAfter,
993
994
  diffStyle,
994
995
  index,
@@ -1005,7 +1006,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
1005
1006
  }), true)) break hunkIterator;
1006
1007
  }
1007
1008
  }
1008
- getPendingCollapsed();
1009
+ consumePendingCollapsed();
1009
1010
  state.incrementCounts(unifiedCount, splitCount);
1010
1011
  unifiedLineIndex += unifiedCount;
1011
1012
  splitLineIndex += splitCount;
@@ -1018,41 +1019,30 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
1018
1019
  if (trailingRegion != null) {
1019
1020
  const { collapsedLines, fromStart, fromEnd } = trailingRegion;
1020
1021
  const len = fromStart + fromEnd;
1021
- const [startIndex, endIndex] = getEqualLineIterationRange(state, len, diffStyle);
1022
- if (startIndex > 0) state.incrementCounts(startIndex, startIndex);
1023
- let index = startIndex;
1024
- while (index < len) {
1025
- if (state.shouldBreak()) break hunkIterator;
1026
- if (index >= endIndex) {
1027
- state.incrementCounts(len - index, len - index);
1028
- break;
1029
- }
1030
- if (state.isInWindow(0, 0)) {
1031
- const isLastLine = index === len - 1;
1032
- if (state.emit({
1033
- hunkIndex: diff.hunks.length,
1034
- hunk: void 0,
1035
- collapsedBefore: 0,
1036
- collapsedAfter: isLastLine ? collapsedLines : 0,
1037
- type: "context-expanded",
1038
- deletionLine: {
1039
- lineNumber: deletionLineNumber + index,
1040
- lineIndex: deletionLineIndex + index,
1041
- noEOFCR: false,
1042
- unifiedLineIndex: unifiedLineIndex + index,
1043
- splitLineIndex: splitLineIndex + index
1044
- },
1045
- additionLine: {
1046
- unifiedLineIndex: unifiedLineIndex + index,
1047
- splitLineIndex: splitLineIndex + index,
1048
- lineIndex: additionLineIndex + index,
1049
- lineNumber: additionLineNumber + index,
1050
- noEOFCR: false
1051
- }
1052
- })) break hunkIterator;
1053
- } else state.incrementCounts(1, 1);
1054
- index++;
1055
- }
1022
+ if (walkContextLines(state, len, diffStyle, (index) => {
1023
+ const isLastLine = index === len - 1;
1024
+ return state.emit({
1025
+ hunkIndex: diff.hunks.length,
1026
+ hunk: void 0,
1027
+ collapsedBefore: 0,
1028
+ collapsedAfter: isLastLine ? collapsedLines : 0,
1029
+ type: "context-expanded",
1030
+ deletionLine: {
1031
+ lineNumber: deletionLineNumber + index,
1032
+ lineIndex: deletionLineIndex + index,
1033
+ noEOFCR: false,
1034
+ unifiedLineIndex: unifiedLineIndex + index,
1035
+ splitLineIndex: splitLineIndex + index
1036
+ },
1037
+ additionLine: {
1038
+ unifiedLineIndex: unifiedLineIndex + index,
1039
+ splitLineIndex: splitLineIndex + index,
1040
+ lineIndex: additionLineIndex + index,
1041
+ lineNumber: additionLineNumber + index,
1042
+ noEOFCR: false
1043
+ }
1044
+ });
1045
+ }, void 0, () => state.shouldBreak())) break hunkIterator;
1056
1046
  }
1057
1047
  }
1058
1048
  }
@@ -1117,15 +1107,14 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
1117
1107
  const leadingCount = leadingRegion.fromStart + leadingRegion.fromEnd;
1118
1108
  splitCount += leadingCount + hunk.splitLineCount;
1119
1109
  unifiedCount += leadingCount + hunk.unifiedLineCount;
1120
- if (index === finalHunkIndex && hasFinalCollapsedHunk(diff)) {
1121
- const trailingRangeSize = getTrailingRangeSize(diff, hunk);
1122
- const trailingRegion = getExpandedRegion({
1123
- isPartial: diff.isPartial,
1124
- rangeSize: trailingRangeSize,
1125
- expandedHunks,
1126
- hunkIndex: diff.hunks.length,
1127
- collapsedContextThreshold
1128
- });
1110
+ const trailingRegion = index === finalHunkIndex ? getTrailingExpandedRegion({
1111
+ fileDiff: diff,
1112
+ hunkIndex: index,
1113
+ expandedHunks,
1114
+ collapsedContextThreshold,
1115
+ errorPrefix: "iterateOverDiff"
1116
+ }) : void 0;
1117
+ if (trailingRegion != null) {
1129
1118
  const trailingCount = trailingRegion.fromStart + trailingRegion.fromEnd;
1130
1119
  splitCount += trailingCount;
1131
1120
  unifiedCount += trailingCount;
@@ -1137,7 +1126,7 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
1137
1126
  }
1138
1127
  return prefixCounts;
1139
1128
  }
1140
- function getEqualLineIterationRange(state, count, diffStyle) {
1129
+ function getContextLineIterationBounds(state, count, diffStyle) {
1141
1130
  if (!state.isWindowedHighlight || count <= 0) return [0, count];
1142
1131
  const ranges = [];
1143
1132
  function pushRange(currentCount) {
@@ -1157,16 +1146,25 @@ function getEqualLineIterationRange(state, count, diffStyle) {
1157
1146
  }
1158
1147
  return [start, end];
1159
1148
  }
1160
- function getTrailingRangeSize(diff, hunk) {
1161
- const additionRemaining = diff.additionLines.length - (hunk.additionLineIndex + hunk.additionCount);
1162
- const deletionRemaining = diff.deletionLines.length - (hunk.deletionLineIndex + hunk.deletionCount);
1163
- if (additionRemaining !== deletionRemaining) throw new Error(`iterateOverDiff: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${diff.name}`);
1164
- return Math.min(additionRemaining, deletionRemaining);
1165
- }
1166
- function hasFinalCollapsedHunk(diff) {
1167
- const lastHunk = diff.hunks.at(-1);
1168
- if (lastHunk == null || diff.isPartial || diff.additionLines.length === 0 || diff.deletionLines.length === 0) return false;
1169
- return lastHunk.additionLineIndex + lastHunk.additionCount < diff.additionLines.length || lastHunk.deletionLineIndex + lastHunk.deletionCount < diff.deletionLines.length;
1149
+ function walkContextLines(state, count, diffStyle, callback, onSkippedStart, shouldBreak) {
1150
+ const [startIndex, endIndex] = getContextLineIterationBounds(state, count, diffStyle);
1151
+ if (startIndex > 0) {
1152
+ state.incrementCounts(startIndex, startIndex);
1153
+ onSkippedStart?.();
1154
+ }
1155
+ let index = startIndex;
1156
+ while (index < count) {
1157
+ if (shouldBreak?.() === true) return true;
1158
+ if (index >= endIndex) {
1159
+ state.incrementCounts(count - index, count - index);
1160
+ break;
1161
+ }
1162
+ if (state.isInWindow(0, 0)) {
1163
+ if (callback(index) === true) return true;
1164
+ } else state.incrementCounts(1, 1);
1165
+ index++;
1166
+ }
1167
+ return false;
1170
1168
  }
1171
1169
  function getChangeIterationRanges(state, content, diffStyle) {
1172
1170
  if (!state.isWindowedHighlight) return [[0, diffStyle === "unified" ? content.deletions + content.additions : Math.max(content.deletions, content.additions)]];