Fixes #85 - Show File Commit Details doesn't work on last line if it is empty

This commit is contained in:
Eric Amodio
2017-06-09 11:48:33 -04:00
parent 50ba3e1446
commit ba59fb29ad
2 changed files with 10 additions and 7 deletions

View File

@@ -190,7 +190,7 @@ export class CurrentLineController extends Disposable {
}
if (commit !== undefined && commitLine !== undefined) {
this.show(commit, commitLine, editor);
this.show(commit, commitLine, editor, line);
}
else {
this.clear(editor);
@@ -215,12 +215,12 @@ export class CurrentLineController extends Disposable {
editor.setDecorations(annotationDecoration, []);
}
async show(commit: GitCommit, blameLine: IGitCommitLine, editor: TextEditor) {
async show(commit: GitCommit, blameLine: IGitCommitLine, editor: TextEditor, line: number) {
// I have no idea why I need this protection -- but it happens
if (editor.document === undefined) return;
this._updateStatusBar(commit);
await this._updateAnnotations(commit, blameLine, editor);
await this._updateAnnotations(commit, blameLine, editor, line);
}
async showAnnotations(editor: TextEditor, type: LineAnnotationType) {
@@ -247,11 +247,11 @@ export class CurrentLineController extends Disposable {
await this._updateBlame(editor.selection.active.line, editor);
}
private async _updateAnnotations(commit: GitCommit, blameLine: IGitCommitLine, editor: TextEditor) {
private async _updateAnnotations(commit: GitCommit, blameLine: IGitCommitLine, editor: TextEditor, line?: number) {
const cfg = this._config.blame.line;
if (!cfg.enabled) return;
const line = blameLine.line + this._uri.offset;
line = line === undefined ? blameLine.line + this._uri.offset : line;
const decorationOptions: DecorationOptions[] = [];