Fix treeview multiselect right-click issue (#210910)

* Treeview with multiselect mishandles right-click outside the selection
Fixes #208849

* No need to clear context

* Do reset context if target is outside selection
This commit is contained in:
Alex Ross
2024-04-22 16:13:22 +02:00
committed by GitHub
parent 0237a19ccc
commit 2ce94ec26a
@@ -800,8 +800,10 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {
event.stopPropagation();
this.tree!.setFocus([node]);
const selected = this.canSelectMany ? this.getSelection() : [];
selected.unshift(node);
let selected = this.canSelectMany ? this.getSelection() : [];
if (selected.length === 0) {
selected = [node];
}
const actions = treeMenus.getResourceContextActions(selected);
if (!actions.length) {
return;
@@ -1565,8 +1567,8 @@ class MultipleSelectionActionRunner extends ActionRunner {
});
}
if (!actionInSelected) {
selectionHandleArgs = undefined;
if (!actionInSelected && selectionHandleArgs && selectionHandleArgs.length > 0) {
context = selectionHandleArgs[0];
}
await action.run(context, selectionHandleArgs);