diff options
author | sestinj <sestinj@gmail.com> | 2023-07-15 15:11:47 -0700 |
---|---|---|
committer | sestinj <sestinj@gmail.com> | 2023-07-15 15:11:47 -0700 |
commit | 2d65ab9e6a6e0009a070ca2c11749126a3bad175 (patch) | |
tree | d22a3795528ec37d2f9c528f929fad6c82be444b /extension/react-app/src/util/index.ts | |
parent | 5921c70228ea74fe2ed687c6bfda8a876d5455c5 (diff) | |
parent | 45ee33f7fd84c0bc49d35d9d1a7a3a8e9f6addd7 (diff) | |
download | sncontinue-2d65ab9e6a6e0009a070ca2c11749126a3bad175.tar.gz sncontinue-2d65ab9e6a6e0009a070ca2c11749126a3bad175.tar.bz2 sncontinue-2d65ab9e6a6e0009a070ca2c11749126a3bad175.zip |
Merge branch 'main' of github.com:continuedev/continue into main
Diffstat (limited to 'extension/react-app/src/util/index.ts')
-rw-r--r-- | extension/react-app/src/util/index.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/extension/react-app/src/util/index.ts b/extension/react-app/src/util/index.ts index ad711321..c4168e13 100644 --- a/extension/react-app/src/util/index.ts +++ b/extension/react-app/src/util/index.ts @@ -1,6 +1,6 @@ type Platform = "mac" | "linux" | "windows" | "unknown"; -function getPlatform(): Platform { +export function getPlatform(): Platform { const platform = window.navigator.platform.toUpperCase(); if (platform.indexOf("MAC") >= 0) { return "mac"; @@ -13,7 +13,7 @@ function getPlatform(): Platform { } } -function isMetaEquivalentKeyPressed(event: { +export function isMetaEquivalentKeyPressed(event: { metaKey: boolean; ctrlKey: boolean; }): boolean { @@ -28,3 +28,16 @@ function isMetaEquivalentKeyPressed(event: { return event.metaKey; } } + +export function getMetaKeyLabel(): string { + const platform = getPlatform(); + switch (platform) { + case "mac": + return "⌘"; + case "linux": + case "windows": + return "^"; + default: + return "⌘"; + } +} |