Skip to content

Commit d3b9307

Browse files
committed
REPORTGEN-397 : fix source code display when number of code lines in bookmark is smaller than offset
1 parent a1f8425 commit d3b9307

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

CastReporting.BLL/BO/SnapshotBLL.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,13 +781,15 @@ public List<Tuple<string, Dictionary<int, string>>> GetSourceCode(string domainI
781781
string siteId = _fragment.CodeFile.GetSiteId();
782782
string fileId = _fragment.CodeFile.GetFileId();
783783
int startLine = _fragment.StartLine;
784+
int endLine = _fragment.EndLine;
785+
int endIdx = (endLine - startLine < offset) ? endLine : startLine + offset;
786+
784787
Dictionary<int, string> codeLines = new Dictionary<int, string>();
785788
int idx = startLine;
786-
List<string> lines = castRepository.GetFileContent(domainId, siteId, fileId, idx, startLine + offset);
787-
int ctr = startLine + offset - idx;
788-
for (int i = 0; i < ctr; i++)
789+
List<string> lines = castRepository.GetFileContent(domainId, siteId, fileId, idx, endIdx);
790+
foreach (string _line in lines)
789791
{
790-
string line = lines[i].Replace("\u001a", "");
792+
string line = _line.Replace("\u001a", "");
791793
codeLines.Add(idx, line);
792794
idx++;
793795
}

0 commit comments

Comments
 (0)