Skip to content

Commit 2d24ebe

Browse files
committed
Fixed line length in diff
1 parent 32f76f7 commit 2d24ebe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Editor/GitDiffWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public void DrawGitDiff(Vector2 size, HunkAction stageHunk, HunkAction unstageHu
224224
showLongDiff = true;
225225
return;
226226
}
227-
int longestLine = diffLines.Max(x => x.Length);
228-
float width = Mathf.Max(diffUnchanged.Value.CalcSize(new GUIContent(new string(' ', longestLine))).x, size.x) + 100;
227+
string longestLine = diffLines.OrderByDescending(x => x.Length).First();
228+
float width = Mathf.Max(diffUnchanged.Value.CalcSize(new GUIContent(longestLine)).x, size.x) + 100;
229229
int currentAddedLine = 1;
230230
int currentRemovedLine = 1;
231231
int currentLine = 1;
@@ -252,7 +252,7 @@ public void DrawGitDiff(Vector2 size, HunkAction stageHunk, HunkAction unstageHu
252252
}
253253
else if (diffLines[i][0] == 'd')
254254
{
255-
if (diffLines[i + 2].StartsWith("Binary"))
255+
if (diffLines[i + 2].StartsWith("Binary") || diffLines[i + 3].StartsWith("Binary"))
256256
{
257257
EditorGUI.SelectableLabel(new Rect(0, currentOffset, width, headerHeight), diffLines[i + 2], Style.FileName.Value);
258258
break;

0 commit comments

Comments
 (0)