From dbbe750a3f9fe983e0fc5e73af32555ec229cb0c Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 17 Mar 2018 13:36:34 +0100 Subject: [PATCH] Fix \r\n bug in LinePositionMapper --- .../Documentation/XmlDocumentationProvider.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs index d55b836bb..289138caa 100644 --- a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs +++ b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs @@ -232,6 +232,7 @@ namespace ICSharpCode.Decompiler.Documentation readonly FileStream fs; readonly Decoder decoder; int currentLine = 1; + char prevChar = '\0'; // buffers for use with Decoder: byte[] input = new byte[1]; @@ -246,7 +247,6 @@ namespace ICSharpCode.Decompiler.Documentation public int GetPositionForLine(int line) { Debug.Assert(line >= currentLine); - char prevChar = '\0'; while (line > currentLine) { int b = fs.ReadByte(); if (b < 0) @@ -260,8 +260,6 @@ namespace ICSharpCode.Decompiler.Documentation if ((prevChar != '\r' && output[0] == '\n') || output[0] == '\r') currentLine++; prevChar = output[0]; - } else { - prevChar = '\0'; } } return checked((int)fs.Position);