Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.59.0 OS Version: Arch Linux Steps to Reproduce: two or more terminals in the panel. one or more terminals into the editor area. ! to rename either an unfocused editor area terminal, or if only one terminal remains in the panel, the panel terminal by right clicking when the editor area has had last focus. ! ! ! name of the most recently focused editor terminal (even if none is presently selected) changes, rather than the right-clicked terminal (whether an unfocused editor area terminal or the unfocused panel terminal). ! Expected behaviour: The name of the terminal selected on right click will be changed.
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.56 --- <!-- score: 0.536 --- <!-- score: 0.526 --- <!-- score: 0.523 --- <!-- score: 0.514 --<!-- potentialduplicatescomment --
Same applies to color and icon
It's still the case that the active editor terminal, rather than the one that was right-clicked on, is the one that the changes get applied to.

Discussion:
precondition: TerminalContextKeys.processSupported }); } <del> async run(accessor: ServicesAccessor) { return accessor.get(ITerminalService).activeInstance?.changeIcon(); </del> <ins> async run(accessor: ServicesAccessor, resource: unknown) { const terminalService = accessor.get(ITerminalService); const castedResource = URI.isUri(resource) ? resource : undefined; const instance = terminalService.getInstanceFromResource(castedResource) || terminalService.activeInstance; instance?.changeIcon(); </ins> } }); registerAction2(class extends Action2 {

precondition: TerminalContextKeys.processSupported }); } <del> async run(accessor: ServicesAccessor) { return accessor.get(ITerminalService).activeInstance?.changeColor(); </del> <ins> async run(accessor: ServicesAccessor, resource: unknown) { const terminalService = accessor.get(ITerminalService); const castedResource = URI.isUri(resource) ? resource : undefined; const instance = terminalService.getInstanceFromResource(castedResource) || terminalService.activeInstance; instance?.changeColor(); </ins> } }); registerAction2(class extends Action2 {

precondition: TerminalContextKeys.processSupported }); } <del> async run(accessor: ServicesAccessor) { return accessor.get(ITerminalService).activeInstance?.rename(); </del> <ins> async run(accessor: ServicesAccessor, resource: unknown) { const terminalService = accessor.get(ITerminalService); const castedResource = URI.isUri(resource) ? resource : undefined; const instance = terminalService.getInstanceFromResource(castedResource) || terminalService.activeInstance; instance?.rename(); </ins> } }); registerAction2(class extends Action2 { constructor() { super({

} async run(accessor: ServicesAccessor, eventOrOptionsOrProfile: MouseEvent | ICreateTerminalOptions | ITerminalProfile | { profileName: string } | undefined, profile?: ITerminalProfile) { const terminalService = accessor.get(ITerminalService); <ins> if (!terminalService.isProcessSupportRegistered) { return; } </ins> const terminalGroupService = accessor.get(ITerminalGroupService); const workspaceContextService = accessor.get(IWorkspaceContextService); const commandService = accessor.get(ICommandService); let event: MouseEvent | PointerEvent | KeyboardEvent | undefined; let options: ICreateTerminalOptions | undefined; <ins> let instance: ITerminalInstance | undefined; let cwd: string | URI | undefined; </ins> if (typeof eventOrOptionsOrProfile === 'object' && eventOrOptionsOrProfile && 'profileName' in eventOrOptionsOrProfile) { const config = terminalService.availableProfiles.find(profile => profile.profileName === eventOrOptionsOrProfile.profileName); if (!config) {

options = convertOptionsOrProfileToOptions(eventOrOptionsOrProfile); } <del> const folders = workspaceContextService.getWorkspace().folders; </del> <ins> // split terminal </ins> if (event && (event.altKey || event.ctrlKey)) { const parentTerminal = terminalService.activeInstance; if (parentTerminal) { <del> const cwd = await getCwdForSplit(terminalService.configHelper, parentTerminal); </del> <ins> cwd = await getCwdForSplit(terminalService.configHelper, parentTerminal); </ins> await terminalService.createTerminal({ location: { parentTerminal }, config: options?.config, cwd }); return; } } <del> if (terminalService.isProcessSupportRegistered) { let instance: ITerminalInstance | undefined; let cwd: string | URI | undefined; if (folders.length > 1) { // multi-root workspace, create root picker const options: IPickOptions<IQuickPickItem> = { placeHolder: localize('workbench.action.terminal.newWorkspacePlaceholder', "Select current working directory for new terminal") }; const workspace = await commandService.executeCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, [options]); if (!workspace) { // Don't create the instance if the workspace picker was canceled return; } cwd = workspace.uri; </del> <ins> const folders = workspaceContextService.getWorkspace().folders; if (folders.length > 1) { // multi-root workspace, create root picker const options: IPickOptions<IQuickPickItem> = { placeHolder: localize('workbench.action.terminal.newWorkspacePlaceholder', "Select current working directory for new terminal") }; const workspace = await commandService.executeCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, [options]); if (!workspace) { // Don't create the instance if the workspace picker was canceled return; </ins> } <ins> cwd = workspace.uri; } </ins> <del> if (options) { instance = await terminalService.createTerminal(options); } else { instance = await terminalService.showProfileQuickPick('createInstance', cwd); } </del> <ins> if (options) { instance = await terminalService.createTerminal(options); } else { instance = await terminalService.showProfileQuickPick('createInstance', cwd); } </ins> <del> if (instance) { terminalService.setActiveInstance(instance); if (instance.target === TerminalLocation.Editor) { await instance.focusWhenReady(true); } else { await terminalGroupService.showPanel(true); } </del> <ins> if (instance) { terminalService.setActiveInstance(instance); if (instance.target === TerminalLocation.Editor) { await instance.focusWhenReady(true); } else { await terminalGroupService.showPanel(true); </ins> } } } });

} } <ins> public override getDescription(): string | undefined { return this._terminalInstance?.shellLaunchConfig.description; } </ins> public override toUntyped(): IUntypedEditorInput { return { resource: this.resource,

import { getInstanceFromResource, parseTerminalUri } from 'vs/workbench/contrib/terminal/browser/terminalUri'; import { ILocalTerminalService, IOffProcessTerminalService } from 'vs/workbench/contrib/terminal/common/terminal'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; <del> import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; </del> <ins> import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; </ins> import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';

if (resource) { await this._editorService.openEditor({ resource, <ins> description: instance.shellLaunchConfig.description, </ins> options: { pinned: true, forceReload: true, preserveFocus: editorOptions?.preserveFocus } <del> }, editorOptions?.viewColumn); </del> <ins> }, editorOptions?.viewColumn || ACTIVE_GROUP); </ins> } }

this._onDidChangeInstances.fire(); } <del> getInstanceFromResource(resource: URI | undefined): ITerminalInstance | undefined { </del> <ins> getInstanceFromResource(resource?: URI): ITerminalInstance | undefined { </ins> return getInstanceFromResource(this.instances, resource); }

if (resource) { this._editorService.openEditor({ resource: URI.revive(resource), <ins> description: instance.shellLaunchConfig.description, </ins> options: { pinned: true,