Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/workbench/contrib/scm/browser/scmViewPane.ts')
-rw-r--r--src/vs/workbench/contrib/scm/browser/scmViewPane.ts31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
index 1a733fb7680..56be4b4065f 100644
--- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
+++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
@@ -2400,6 +2400,7 @@ export class SCMViewPane extends ViewPane {
if (widget) {
widget.focus();
+ this.tree.setFocus([], e.browserEvent);
const selection = this.tree.getSelection();
@@ -2411,7 +2412,13 @@ export class SCMViewPane extends ViewPane {
return;
} else if (isSCMActionButton(e.element)) {
this.scmViewService.focus(e.element.repository);
- this.actionButtonRenderer.focusActionButton(e.element);
+
+ // Focus the action button
+ const target = e.browserEvent?.target as HTMLElement;
+ if (target.classList.contains('monaco-tl-row') || target.classList.contains('button-container')) {
+ this.actionButtonRenderer.focusActionButton(e.element);
+ this.tree.setFocus([], e.browserEvent);
+ }
return;
}
@@ -2637,19 +2644,11 @@ export class SCMActionButton implements IDisposable {
return;
}
- const executeButtonAction = async (commandId: string, ...args: any[]) => {
- try {
- await this.commandService.executeCommand(commandId, ...args);
- } catch (ex) {
- this.notificationService.error(ex);
- }
- };
-
if (button.secondaryCommands?.length) {
const actions: IAction[] = [];
for (let index = 0; index < button.secondaryCommands.length; index++) {
for (const command of button.secondaryCommands[index]) {
- actions.push(new Action(command.id, command.title, undefined, true, async () => await executeButtonAction(command.id, ...(command.arguments || []))));
+ actions.push(new Action(command.id, command.title, undefined, true, async () => await this.executeCommand(command.id, ...(command.arguments || []))));
}
if (index !== button.secondaryCommands.length - 1) {
actions.push(new Separator());
@@ -2661,6 +2660,7 @@ export class SCMActionButton implements IDisposable {
actions: actions,
addPrimaryActionToDropdown: false,
contextMenuProvider: this.contextMenuService,
+ title: button.command.tooltip,
supportIcons: true
});
} else if (button.description) {
@@ -2674,8 +2674,7 @@ export class SCMActionButton implements IDisposable {
this.button.enabled = button.enabled;
this.button.label = button.command.title;
- this.button.element.title = button.command.tooltip ?? '';
- this.button.onDidClick(async () => await executeButtonAction(button.command.id, ...(button.command.arguments || [])), null, this.disposables.value);
+ this.button.onDidClick(async () => await this.executeCommand(button.command.id, ...(button.command.arguments || [])), null, this.disposables.value);
this.disposables.value!.add(this.button);
this.disposables.value!.add(attachButtonStyler(this.button, this.themeService));
@@ -2690,4 +2689,12 @@ export class SCMActionButton implements IDisposable {
this.button = undefined;
clearNode(this.container);
}
+
+ private async executeCommand(commandId: string, ...args: any[]): Promise<void> {
+ try {
+ await this.commandService.executeCommand(commandId, ...args);
+ } catch (ex) {
+ this.notificationService.error(ex);
+ }
+ }
}