mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 01:25:42 -05:00
Fixes errors when selecting the last blank line
This commit is contained in:
@@ -132,7 +132,8 @@ export class BlameAnnotationProvider extends Disposable {
|
||||
else if (typeof shaOrLine === 'number') {
|
||||
const line = shaOrLine - offset;
|
||||
if (line >= 0) {
|
||||
sha = blame.lines[line].sha;
|
||||
const commitLine = blame.lines[line];
|
||||
sha = commitLine && commitLine.sha;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -193,6 +194,7 @@ export class BlameAnnotationProvider extends Disposable {
|
||||
const hoverMessage = BlameAnnotationFormatter.getAnnotationHover(this._config, l, commit);
|
||||
|
||||
// Escape single quotes because for some reason that breaks the ::before or ::after element
|
||||
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
|
||||
gutter = gutter.replace(/\'/g, '\\\'');
|
||||
|
||||
lastSha = l.sha;
|
||||
@@ -276,6 +278,7 @@ export class BlameAnnotationProvider extends Disposable {
|
||||
|
||||
const format = trailing ? BlameAnnotationFormat.Unconstrained : BlameAnnotationFormat.Constrained;
|
||||
// Escape single quotes because for some reason that breaks the ::before or ::after element
|
||||
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
|
||||
const gutter = BlameAnnotationFormatter.getAnnotation(this._config, commit, format).replace(/\'/g, '\\\'');
|
||||
const hoverMessage = BlameAnnotationFormatter.getAnnotationHover(this._config, l, commit);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import { TextDocumentComparer, TextEditorComparer } from './comparers';
|
||||
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
|
||||
import { DocumentSchemes } from './constants';
|
||||
import GitProvider, { GitCommit, GitUri, IGitBlame, IGitCommitLine } from './gitProvider';
|
||||
import { Logger } from './logger';
|
||||
import * as moment from 'moment';
|
||||
|
||||
const activeLineDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
|
||||
@@ -160,15 +159,9 @@ export default class BlameStatusBarController extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
commitLine = blame.lines[line];
|
||||
const sha = commitLine.sha;
|
||||
commit = blame.commits.get(sha);
|
||||
}
|
||||
catch (ex) {
|
||||
Logger.error(`DEBUG(${this._uri.toString()}): Line ${line} not found in blame; lines=${blame.lines.length}, uriOffset=${this._uri.offset}, repoPath=${blame.repoPath}`);
|
||||
throw ex;
|
||||
}
|
||||
commitLine = blame.lines[line];
|
||||
const sha = commitLine && commitLine.sha;
|
||||
commit = sha && blame.commits.get(sha);
|
||||
}
|
||||
else {
|
||||
const blameLine = await this.git.getBlameForLine(this._uri.fsPath, line, this._uri.sha, this._uri.repoPath);
|
||||
@@ -246,6 +239,7 @@ export default class BlameStatusBarController extends Disposable {
|
||||
} as IBlameConfig;
|
||||
|
||||
// Escape single quotes because for some reason that breaks the ::before or ::after element
|
||||
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
|
||||
const annotation = BlameAnnotationFormatter.getAnnotation(config, commit, BlameAnnotationFormat.Unconstrained).replace(/\'/g, '\\\'');
|
||||
|
||||
// Get the full commit message -- since blame only returns the summary
|
||||
|
||||
Reference in New Issue
Block a user