Skip to content

Commit c5e292b

Browse files
committed
Fixes preview tabs when clicking files in details
Adds dblclick to open in non-preview tabs
1 parent 4570849 commit c5e292b

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

src/webviews/apps/commitDetails/components/gl-details-base.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export class GlDetailsBase extends LitElement {
429429
const [file] = e.detail.context;
430430
const event = new CustomEvent('file-open', {
431431
detail: this.getEventDetail(file, {
432-
preview: false,
432+
preview: !e.detail.dblClick,
433433
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
434434
}),
435435
});
@@ -442,7 +442,7 @@ export class GlDetailsBase extends LitElement {
442442
const [file] = e.detail.context;
443443
const event = new CustomEvent('file-open-on-remote', {
444444
detail: this.getEventDetail(file, {
445-
preview: false,
445+
preview: !e.detail.dblClick,
446446
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
447447
}),
448448
});
@@ -455,7 +455,7 @@ export class GlDetailsBase extends LitElement {
455455
const [file] = e.detail.context;
456456
const event = new CustomEvent('file-compare-working', {
457457
detail: this.getEventDetail(file, {
458-
preview: false,
458+
preview: !e.detail.dblClick,
459459
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
460460
}),
461461
});
@@ -468,7 +468,7 @@ export class GlDetailsBase extends LitElement {
468468
const [file] = e.detail.context;
469469
const event = new CustomEvent('file-compare-previous', {
470470
detail: this.getEventDetail(file, {
471-
preview: false,
471+
preview: !e.detail.dblClick,
472472
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
473473
}),
474474
});
@@ -491,7 +491,7 @@ export class GlDetailsBase extends LitElement {
491491
const [file] = e.detail.context;
492492
const event = new CustomEvent('file-stage', {
493493
detail: this.getEventDetail(file, {
494-
preview: false,
494+
preview: !e.detail.dblClick,
495495
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
496496
}),
497497
});
@@ -504,7 +504,7 @@ export class GlDetailsBase extends LitElement {
504504
const [file] = e.detail.context;
505505
const event = new CustomEvent('file-unstage', {
506506
detail: this.getEventDetail(file, {
507-
preview: false,
507+
preview: !e.detail.dblClick,
508508
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
509509
}),
510510
});

src/webviews/apps/plus/patchDetails/components/gl-draft-details.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ export class GlDraftDetails extends GlTreeBase {
745745
this.emit('gl-patch-file-compare-working', {
746746
...file,
747747
showOptions: {
748-
preview: false,
748+
preview: !e.detail.dblClick,
749749
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
750750
},
751751
});
@@ -758,7 +758,7 @@ export class GlDraftDetails extends GlTreeBase {
758758
this.emit('gl-patch-file-open', {
759759
...file,
760760
showOptions: {
761-
preview: false,
761+
preview: !e.detail.dblClick,
762762
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
763763
},
764764
});

src/webviews/apps/plus/patchDetails/components/gl-patch-create.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ export class GlPatchCreate extends GlTreeBase {
774774
this.emit('gl-patch-file-open', {
775775
...file,
776776
showOptions: {
777-
preview: false,
777+
preview: !e.detail.dblClick,
778778
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
779779
},
780780
});
@@ -787,7 +787,7 @@ export class GlPatchCreate extends GlTreeBase {
787787
this.emit('gl-patch-file-stage', {
788788
...file,
789789
showOptions: {
790-
preview: false,
790+
preview: !e.detail.dblClick,
791791
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
792792
},
793793
});
@@ -800,7 +800,7 @@ export class GlPatchCreate extends GlTreeBase {
800800
this.emit('gl-patch-file-unstage', {
801801
...file,
802802
showOptions: {
803-
preview: false,
803+
preview: !e.detail.dblClick,
804804
viewColumn: e.detail.altKey ? BesideViewColumn : undefined,
805805
},
806806
});

src/webviews/apps/shared/components/tree/tree-generator.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export class GlTreeGenerator extends GlElement {
7878
.icon=${action.icon}
7979
.label=${action.label}
8080
@click=${(e: MouseEvent) => this.onTreeItemActionClicked(e, model, action)}
81+
@dblclick=${(e: MouseEvent) => this.onTreeItemActionDblClicked(e, model, action)}
8182
></action-item>`;
8283
});
8384
}
@@ -170,6 +171,19 @@ export class GlTreeGenerator extends GlElement {
170171
metaKey: e.metaKey,
171172
});
172173
}
174+
175+
private onTreeItemActionDblClicked(e: MouseEvent, model: TreeModelFlat, action: TreeItemAction) {
176+
e.stopPropagation();
177+
this.emit('gl-tree-generated-item-action-clicked', {
178+
node: model,
179+
context: model.context,
180+
action: action,
181+
dblClick: true,
182+
altKey: e.altKey,
183+
ctrlKey: e.ctrlKey,
184+
metaKey: e.metaKey,
185+
});
186+
}
173187
}
174188

175189
function flattenTree(tree: TreeModel, children: number = 1, position: number = 1): TreeModelFlat[] {

0 commit comments

Comments
 (0)