Change:
Testing an editor and write something in it. tab until you reach the terminal. Type something in the terminal. . Realize that tab is correctly not moving focus in the terminal. command "Toggle Tab Key Moves Focus" out of the terminal and keep tabbing until you get back to your editor. something in the editor. again until you reach the terminal. something in the terminal. to tab out of the terminal. It looks like tab moves focus as toggled itself off. Tab moves focus seems to be off for both terminal and editor at this point until reload.
I can also cause similar behavior if I flip the settings.
what is supposed to happen now? What I think I expect to happen (and isn't happening): If I run "Toggle tab key moves focus" while in a place where it doesn't move focus via setting, then it now globally moves focus. If I run "Toggle tab key moves focus" while in a place where it does move focus, then it now globally does not move focus. However, I'm not a "tab moves focus" user, so maybe my expectations are bogus.
Thank you for testing. Those expectations are correct, except that the toggling does not apply globally - it is per area. So, if I have in settings: terminal tab focus mode: on editor tab focus mode: off where: = status bar indicator = no status bar indicator focus the terminal focus the editor focus the terminal and toggle it off focus the editor and toggle it on focus the terminal focus the editor reload the window and focus the terminal focus the editor I see that this is not working atm because I'm not reacting to configuration changes
fyi for easier testing since the command palette can cause the terminal to no longer be focused, I'd suggest using the keybinding to toggle tab focus mode

Discussion:
private _tabFocusTerminal: boolean = false; private _tabFocusEditor: boolean = false; <del> private readonly _onDidChangeTabFocus = new Emitter<boolean>(); public readonly onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event; </del> <ins> private readonly _onDidChangeTabFocus = new Emitter<void>(); public readonly onDidChangeTabFocus: Event<void> = this._onDidChangeTabFocus.event; </ins> public getTabFocusMode(context: TabFocusContext): boolean { return context === TabFocusContext.Terminal ? this._tabFocusTerminal : this._tabFocusEditor; } public setTabFocusMode(tabFocusMode: boolean, context: TabFocusContext): void { <del> if ((context === TabFocusContext.Terminal && this._tabFocusTerminal === tabFocusMode) || (context === TabFocusContext.Editor && this._tabFocusEditor === tabFocusMode)) { return; } </del> if (context === TabFocusContext.Terminal) { this._tabFocusTerminal = tabFocusMode; } else { this._tabFocusEditor = tabFocusMode; } <del> this._onDidChangeTabFocus.fire(this._tabFocusTerminal); </del> <ins> this._onDidChangeTabFocus.fire(); </ins> } }

private readonly languageElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>()); private readonly metadataElement = this._register(new MutableDisposable<IStatusbarEntryAccessor>()); private readonly currentProblemStatus: ShowCurrentMarkerInStatusbarContribution = this._register(this.instantiationService.createInstance(ShowCurrentMarkerInStatusbarContribution)); <ins> private _previousViewContext: 'terminal' | 'editor' | undefined; </ins> private readonly state = new State(); private readonly activeEditorListeners = this._register(new DisposableStore()); private readonly delayedRender = this._register(new MutableDisposable());

this._register(this.textFileService.untitled.onDidChangeEncoding(model => this.onResourceEncodingChange(model.resource))); this._register(this.textFileService.files.onDidChangeEncoding(model => this.onResourceEncodingChange((model.resource)))); this._register(Event.runAndSubscribe(TabFocus.onDidChangeTabFocus, () => this.onTabFocusModeChange())); <ins> const viewKey = new Set<string>(); viewKey.add('focusedView'); this._register(this.contextKeyService.onDidChangeContext((c) => { if (c.affectsSome(viewKey)) { const terminalFocus = this.contextKeyService.getContextKeyValue('focusedView') === 'terminal'; const context = terminalFocus ? 'terminal' : 'editor'; if (this._previousViewContext === context) { return; } this._previousViewContext = context; this.onTabFocusModeChange(); } })); </ins> } private registerCommands(): void {

import { Schemas } from 'vs/base/common/network'; import { TabFocus, TabFocusContext } from 'vs/editor/browser/config/tabFocus'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; <del> import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; </del> import { ILabelService } from 'vs/platform/label/common/label'; import { TerminalSettingId } from 'vs/platform/terminal/common/terminal'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions';

@ITerminalService terminalService: ITerminalService, @ITerminalEditorService terminalEditorService: ITerminalEditorService, @ITerminalGroupService terminalGroupService: ITerminalGroupService, <del> @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService </del> <ins> @IConfigurationService configurationService: IConfigurationService </ins> ) { super();

} }); <del> const viewKey = new Set<string>(); viewKey.add('focusedView'); </del> TabFocus.setTabFocusMode(configurationService.getValue('editor.tabFocusMode'), TabFocusContext.Editor); TabFocus.setTabFocusMode(configurationService.getValue(TerminalSettingId.TabFocusMode), TabFocusContext.Terminal); <del> this._register(contextKeyService.onDidChangeContext((c) => { if (c.affectsSome(viewKey)) { if (contextKeyService.getContextKeyValue('focusedView') === 'terminal') { TabFocus.setTabFocusMode(configurationService.getValue(TerminalSettingId.TabFocusMode), TabFocusContext.Terminal); } else { TabFocus.setTabFocusMode(configurationService.getValue('editor.tabFocusMode'), TabFocusContext.Editor); } } })); </del> } }