Skip to content

Commit ddc4eec

Browse files
committed
Only call End once
1 parent c2b14bd commit ddc4eec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,12 @@ public static bool HasLFLineEndings(this SourceText text)
341341

342342
foreach (var line in text.Lines)
343343
{
344-
if (line.EndIncludingLineBreak - line.End == 2)
344+
var lineBreakLength = line.EndIncludingLineBreak - line.End;
345+
if (lineBreakLength == 2)
345346
{
346347
crlfCount++;
347348
}
348-
else if (line.EndIncludingLineBreak != line.End)
349+
else if (lineBreakLength != 0)
349350
{
350351
lfCount++;
351352
}

0 commit comments

Comments
 (0)