mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-20 09:45:36 -05:00
Fixes jumpiness when opening a diff
This commit is contained in:
@@ -60,16 +60,18 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
|
||||
this.git.getVersionedFile(args.commit.repoPath, args.commit.uri.fsPath, args.commit.sha)
|
||||
]);
|
||||
|
||||
if (args.line !== undefined && args.line !== 0) {
|
||||
if (args.showOptions === undefined) {
|
||||
args.showOptions = {};
|
||||
}
|
||||
args.showOptions.selection = new Range(args.line, 0, args.line, 0);
|
||||
}
|
||||
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(lhs),
|
||||
Uri.file(rhs),
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.nextUri.fsPath)} (${args.commit.nextShortSha})`,
|
||||
args.showOptions);
|
||||
|
||||
if (args.line === undefined || args.line === 0) return undefined;
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
return await commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: args.line, at: 'center' });
|
||||
}
|
||||
catch (ex) {
|
||||
Logger.error(ex, 'DiffWithNextCommand', 'getVersionedFile');
|
||||
|
||||
Reference in New Issue
Block a user