From ffc6def5ae228355fe8a3c621f0b47a84de0d03f Mon Sep 17 00:00:00 2001 From: Olaf Lessenich Date: Wed, 14 Dec 2022 19:50:31 +0100 Subject: [PATCH] Revise behavior of TerminalEditorLocationOptions --- .../browser/terminal-frontend-contribution.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 315e79b4552d4..749fc70bb1570 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -657,22 +657,17 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu switch (widget.location.viewColumn) { case ViewColumn.Active: widgetOptions.ref = this.shell.currentWidget; - widgetOptions.mode = 'tab-before'; + widgetOptions.mode = 'tab-after'; break; case ViewColumn.Beside: widgetOptions.ref = this.shell.currentWidget; - widgetOptions.mode = 'tab-after'; + widgetOptions.mode = 'split-right'; break; default: - const widgets = this.all.filter(t => t.isVisible); - const index = widget.location.viewColumn - 1; - if (index < widgets.length) { - widgetOptions.ref = widgets[index]; - widgetOptions.mode = 'open-to-left'; - } else { - widgetOptions.ref = widgets[widgets.length - 1]; - widgetOptions.mode = 'open-to-right'; - } + widgetOptions.area = 'main'; + const mainAreaTerminals = this.shell.getWidgets('main').filter(w => w instanceof TerminalWidget && w.isVisible); + const column = widget.location.viewColumn < mainAreaTerminals.length ? widget.location.viewColumn : mainAreaTerminals.length; + widgetOptions.ref = mainAreaTerminals[column - 1]; } } }