dont focus panels when they are shown; dont swallow keys for message panel (#5872)

This commit is contained in:
Anthony Dresser
2019-06-04 12:54:54 -07:00
committed by Karl Burtram
parent 540635c54f
commit 67859ab139
2 changed files with 8 additions and 14 deletions

View File

@@ -197,7 +197,6 @@ export class TabbedPanel extends Disposable {
if (this._currentDimensions) { if (this._currentDimensions) {
this._layoutCurrentTab(new DOM.Dimension(this._currentDimensions.width, this._currentDimensions.height - this.headersize)); this._layoutCurrentTab(new DOM.Dimension(this._currentDimensions.width, this._currentDimensions.height - this.headersize));
} }
this.focus();
} }
public removeTab(tab: PanelTabIdentifier) { public removeTab(tab: PanelTabIdentifier) {

View File

@@ -110,20 +110,18 @@ export class MessagePanel extends Disposable {
this._register(this.themeService.onThemeChange(this.applyStyles, this)); this._register(this.themeService.onThemeChange(this.applyStyles, this));
this.applyStyles(this.themeService.getTheme()); this.applyStyles(this.themeService.getTheme());
this.controller.onKeyDown = (tree, event) => { this.controller.onKeyDown = (tree, event) => {
if (event.ctrlKey) { if (event.ctrlKey && event.code === 'KeyC') {
let context: IMessagesActionContext = { let context: IMessagesActionContext = {
selection: document.getSelection(), selection: document.getSelection(),
tree: this.tree, tree: this.tree,
}; };
// Ctrl + C for copy let copyMessageAction = instantiationService.createInstance(CopyMessagesAction, this.clipboardService);
if (event.code === 'KeyC') { copyMessageAction.run(context);
let copyMessageAction = instantiationService.createInstance(CopyMessagesAction, this.clipboardService); event.preventDefault();
copyMessageAction.run(context); event.stopPropagation();
} return true;
} }
event.preventDefault(); return false;
event.stopPropagation();
return true;
}; };
this.controller.onContextMenu = (tree, element, event) => { this.controller.onContextMenu = (tree, element, event) => {
if (event.target && event.target.tagName && event.target.tagName.toLowerCase() === 'input') { if (event.target && event.target.tagName && event.target.tagName.toLowerCase() === 'input') {
@@ -370,15 +368,12 @@ export class MessageController extends WorkbenchTreeController {
constructor( constructor(
options: IControllerOptions, options: IControllerOptions,
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
@IEditorService private workbenchEditorService: IEditorService, @IEditorService private workbenchEditorService: IEditorService
@IContextMenuService private contextMenuService: IContextMenuService,
@IInstantiationService private instantiationService: IInstantiationService
) { ) {
super(options, configurationService); super(options, configurationService);
} }
protected onLeftClick(tree: ITree, element: any, eventish: ICancelableEvent, origin: string = 'mouse'): boolean { protected onLeftClick(tree: ITree, element: any, eventish: ICancelableEvent, origin: string = 'mouse'): boolean {
const mouseEvent = <IMouseEvent>eventish;
// input and output are one element in the tree => we only expand if the user clicked on the output. // input and output are one element in the tree => we only expand if the user clicked on the output.
// if ((element.reference > 0 || (element instanceof RawObjectReplElement && element.hasChildren)) && mouseEvent.target.className.indexOf('input expression') === -1) { // if ((element.reference > 0 || (element instanceof RawObjectReplElement && element.hasChildren)) && mouseEvent.target.className.indexOf('input expression') === -1) {
super.onLeftClick(tree, element, eventish, origin); super.onLeftClick(tree, element, eventish, origin);