Skip to content

Commit

Permalink
fix #107154.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Oct 12, 2020
1 parent 3430078 commit bd7746b
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -15,7 +15,7 @@ import { OS, OperatingSystem, isMacintosh } from 'vs/base/common/platform';
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Extensions as ConfigExtensions, IConfigurationNode, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { ContextKeyExpr, IContextKeyService, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
import { ContextKeyExpr, IContextKeyService, ContextKeyExpression, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService';
Expand Down Expand Up @@ -180,6 +180,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
private _keyboardMapper: IKeyboardMapper;
private _cachedResolver: KeybindingResolver | null;
private userKeybindings: UserKeybindings;
private isComposingGlobalContextKey: IContextKey<boolean>;
private readonly _contributions: KeybindingsSchemaContribution[] = [];

constructor(
Expand All @@ -197,6 +198,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
) {
super(contextKeyService, commandService, telemetryService, notificationService, logService);

this.isComposingGlobalContextKey = contextKeyService.createKey('isComposing', false);
this.updateSchema();

let dispatchConfig = getDispatchConfig(configurationService);
Expand Down Expand Up @@ -248,13 +250,15 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
this._register(extensionService.onDidRegisterExtensions(() => this.updateSchema()));

this._register(dom.addDisposableListener(window, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this.isComposingGlobalContextKey.set(e.isComposing);
const keyEvent = new StandardKeyboardEvent(e);
this._log(`/ Received keydown event - ${printKeyboardEvent(e)}`);
this._log(`| Converted keydown event - ${printStandardKeyboardEvent(keyEvent)}`);
const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
if (shouldPreventDefault) {
keyEvent.preventDefault();
}
this.isComposingGlobalContextKey.set(false);
}));

let data = this.keymapService.getCurrentKeyboardLayout();
Expand Down

0 comments on commit bd7746b

Please sign in to comment.