Skip to content

Commit

Permalink
fix(handle affirmation of handlekeys config): closes #2162. handlekey…
Browse files Browse the repository at this point in the history
…s config trumps usectrlkeys config
  • Loading branch information
jpoon committed Jan 5, 2018
1 parent 5d011ef commit 7726ad8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ class ConfigurationClass {
// By default, all key combinations are used
let useKey = true;

if (this.handleKeys[bracketedKey] === false) {
// disabled through `vim.handleKeys`
useKey = false;
let handleKey = this.handleKeys[bracketedKey];
if (handleKey !== undefined) {
// enabled/disabled through `vim.handleKeys`
useKey = handleKey;
} else if (!this.useCtrlKeys && bracketedKey.slice(1, 3) === 'C-') {
// user has disabled CtrlKeys and the current key is a CtrlKey
// <C-c>, still needs to be captured to overrideCopy
Expand All @@ -87,7 +88,7 @@ class ConfigurationClass {
}
}

vscode.commands.executeCommand('setContext', 'vim.use' + bracketedKey, useKey);
vscode.commands.executeCommand('setContext', `vim.use${bracketedKey}`, useKey);
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,6 @@ export class ModeHandler implements vscode.Disposable {
}
this._renderStatusBar();

await vscode.commands.executeCommand(
'setContext',
'vim.useCtrlKeys',
Configuration.useCtrlKeys
);
await vscode.commands.executeCommand(
'setContext',
'vim.overrideCopy',
Expand Down

0 comments on commit 7726ad8

Please sign in to comment.