Skip to content

Commit c5a8fc1

Browse files
committed
Avoid tab check if commit is provided
Related to 3915177
1 parent 0f1f855 commit c5a8fc1

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/commands/diffWithNext.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
3636

3737
let isInLeftSideOfDiffEditor = false;
3838

39-
// Figure out if we are in a diff editor and if so, which side
40-
const [tab] = getVisibleTabs(uri);
41-
if (tab != null) {
42-
const uris = getTabUris(tab);
43-
// If there is an original, then we are in a diff editor -- modified is right, original is left
44-
if (uris.original != null && uriEquals(uri, uris.original)) {
45-
isInLeftSideOfDiffEditor = true;
39+
if (args.commit == null) {
40+
// Figure out if we are in a diff editor and if so, which side
41+
const [tab] = getVisibleTabs(uri);
42+
if (tab != null) {
43+
const uris = getTabUris(tab);
44+
// If there is an original, then we are in a diff editor -- modified is right, original is left
45+
if (uris.original != null && uriEquals(uri, uris.original)) {
46+
isInLeftSideOfDiffEditor = true;
47+
}
4648
}
4749
}
4850

src/commands/diffWithPrevious.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,17 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
7474
let isInRightSideOfDiffEditor = false;
7575
let isDirty = false;
7676

77-
// Figure out if we are in a diff editor and if so, which side
78-
const [tab] = getVisibleTabs(uri);
79-
if (tab != null) {
80-
isDirty = tab.isDirty;
81-
82-
const uris = getTabUris(tab);
83-
// If there is an original, then we are in a diff editor -- modified is right, original is left
84-
if (uris.original != null && uriEquals(uri, uris.modified)) {
85-
isInRightSideOfDiffEditor = true;
77+
if (args.commit == null) {
78+
// Figure out if we are in a diff editor and if so, which side
79+
const [tab] = getVisibleTabs(uri);
80+
if (tab != null) {
81+
isDirty = tab.isDirty;
82+
83+
const uris = getTabUris(tab);
84+
// If there is an original, then we are in a diff editor -- modified is right, original is left
85+
if (uris.original != null && uriEquals(uri, uris.modified)) {
86+
isInRightSideOfDiffEditor = true;
87+
}
8688
}
8789
}
8890

0 commit comments

Comments
 (0)