Skip to content

Commit

Permalink
Fix blob doesn't get rendered if todo is in last line of a file
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Bildner committed Mar 26, 2022
1 parent d5da82d commit e143abd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
11 changes: 3 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions src/TodoDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ function getFileBoundaries(changes: any[], line: number, paddingTop = 0, padding

let start;
if(line == firstChangedLine){
start = Math.max(0, line - paddingTop);
start = Math.max(1, line - paddingTop);
} else {
start = Math.max(line - paddingTop, firstChangedLine)
}

let end;
if(line == lastChangedLine) {
end = line + paddingBottom;
} else {
end = Math.min(line + paddingBottom, lastChangedLine)
}
// we dont know the actual lines count of the file, so we cant add something like minPadding (at least for the bottom)
let end = Math.min(line + paddingBottom, lastChangedLine)

return {start, end}
}
Expand Down

0 comments on commit e143abd

Please sign in to comment.