Skip to content

Commit

Permalink
Fixes #28576: Add support for BrowserBack and BrowserForward
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Oct 18, 2021
1 parent 53e1748 commit 438c92c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/vs/base/browser/keyboardEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ let INVERSE_KEY_CODE_MAP: KeyCode[] = new Array(KeyCode.MAX_VALUE);
define(144, KeyCode.NumLock);
define(145, KeyCode.ScrollLock);

define(166, KeyCode.BrowserBack);
define(167, KeyCode.BrowserForward);

define(186, KeyCode.US_SEMICOLON);
define(187, KeyCode.US_EQUAL);
define(188, KeyCode.US_COMMA);
Expand Down
6 changes: 6 additions & 0 deletions src/vs/base/common/keyCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ export const enum KeyCode {
ABNT_C1 = 110, // Brazilian (ABNT) Keyboard
ABNT_C2 = 111, // Brazilian (ABNT) Keyboard

BrowserBack = 112, // BrowserBack
BrowserForward = 113, // BrowserBack

/**
* Placed last to cover the length of the enum.
* Please do not depend on this value!
Expand Down Expand Up @@ -359,6 +362,9 @@ const userSettingsGeneralMap = new KeyCodeStrMap();
define(KeyCode.NUMPAD_DECIMAL, 'NumPad_Decimal');
define(KeyCode.NUMPAD_DIVIDE, 'NumPad_Divide');

define(KeyCode.BrowserBack, 'BrowserBack');
define(KeyCode.BrowserForward, 'BrowserForward');

})();

export namespace KeyCodeUtils {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/common/scanCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,8 @@ export class ScanCodeBinding implements IBaseKeybinding {
define(ScanCode.LaunchScreenSaver, KeyCode.Unknown);
define(ScanCode.BrowserSearch, KeyCode.Unknown);
define(ScanCode.BrowserHome, KeyCode.Unknown);
define(ScanCode.BrowserBack, KeyCode.Unknown);
define(ScanCode.BrowserForward, KeyCode.Unknown);
define(ScanCode.BrowserBack, KeyCode.BrowserBack);
define(ScanCode.BrowserForward, KeyCode.BrowserForward);
define(ScanCode.BrowserStop, KeyCode.Unknown);
define(ScanCode.BrowserRefresh, KeyCode.Unknown);
define(ScanCode.BrowserFavorites, KeyCode.Unknown);
Expand Down
4 changes: 3 additions & 1 deletion src/vs/editor/common/standalone/standaloneEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,13 @@ export enum KeyCode {
KEY_IN_COMPOSITION = 109,
ABNT_C1 = 110,
ABNT_C2 = 111,
BrowserBack = 112,
BrowserForward = 113,
/**
* Placed last to cover the length of the enum.
* Please do not depend on this value!
*/
MAX_VALUE = 112
MAX_VALUE = 114
}

export enum MarkerSeverity {
Expand Down
4 changes: 3 additions & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,13 @@ declare namespace monaco {
KEY_IN_COMPOSITION = 109,
ABNT_C1 = 110,
ABNT_C2 = 111,
BrowserBack = 112,
BrowserForward = 113,
/**
* Placed last to cover the length of the enum.
* Please do not depend on this value!
*/
MAX_VALUE = 112
MAX_VALUE = 114
}
export class KeyMod {
static readonly CtrlCmd: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ function _getNativeMap() {
VK_RCONTROL: KeyCode.Ctrl,
VK_LMENU: KeyCode.Unknown, // MISSING
VK_RMENU: KeyCode.Unknown, // MISSING
VK_BROWSER_BACK: KeyCode.Unknown, // MISSING
VK_BROWSER_FORWARD: KeyCode.Unknown, // MISSING
VK_BROWSER_BACK: KeyCode.BrowserBack,
VK_BROWSER_FORWARD: KeyCode.BrowserForward,
VK_BROWSER_REFRESH: KeyCode.Unknown, // MISSING
VK_BROWSER_STOP: KeyCode.Unknown, // MISSING
VK_BROWSER_SEARCH: KeyCode.Unknown, // MISSING
Expand Down

0 comments on commit 438c92c

Please sign in to comment.