Fix bug in getDiffChunk()
The binary search was returning null when a line is part of a diff chunk, causing regression in resizePaddingWidget() for comment boxes. Fixed by adding an extra check. Change-Id: I3b0e30173f8cea773d3804abc3ecfea4ef67123d
This commit is contained in:
@@ -1176,7 +1176,18 @@ public class SideBySide2 extends Screen {
|
|||||||
diffChunks,
|
diffChunks,
|
||||||
new DiffChunkInfo(side, line, 0, false), // Dummy DiffChunkInfo
|
new DiffChunkInfo(side, line, 0, false), // Dummy DiffChunkInfo
|
||||||
getDiffChunkComparator());
|
getDiffChunkComparator());
|
||||||
return res >= 0 ? diffChunks.get(res) : null;
|
if (res >= 0) {
|
||||||
|
return diffChunks.get(res);
|
||||||
|
} else { // The line might be within a DiffChunk
|
||||||
|
res = -res - 1;
|
||||||
|
if (res > 0) {
|
||||||
|
DiffChunkInfo info = diffChunks.get(res - 1);
|
||||||
|
if (info.side == side && info.start <= line && line <= info.end) {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getWrapAroundDiffChunkIndex(int index) {
|
private int getWrapAroundDiffChunkIndex(int index) {
|
||||||
|
Reference in New Issue
Block a user