mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-01 13:15:50 +01:00
333d9a4053
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
39 lines
865 B
TypeScript
39 lines
865 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
export class KeybindingParser {
|
|
|
|
public static _readModifiers(input: string) {
|
|
input = input.toLowerCase().trim();
|
|
|
|
let ctrl = false;
|
|
let shift = false;
|
|
let alt = false;
|
|
let meta = false;
|
|
|
|
|
|
|
|
let key: string;
|
|
|
|
const firstSpaceIdx = input.indexOf(' ');
|
|
if (firstSpaceIdx > 0) {
|
|
key = input.substring(0, firstSpaceIdx);
|
|
input = input.substring(firstSpaceIdx);
|
|
} else {
|
|
key = input;
|
|
input = '';
|
|
}
|
|
|
|
return {
|
|
remains: input,
|
|
ctrl,
|
|
shift,
|
|
alt,
|
|
meta,
|
|
key
|
|
};
|
|
}
|
|
}
|