diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index 0c90383e20d..6ca5d961ae8 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -366,9 +366,9 @@ export class ModeHandler implements vscode.Disposable { case KeypressState.NoPossibleMatch: if (!this._remappers.isPotentialRemap) { vimState.recordedState = new RecordedState(); - return vimState; } - break; + + return vimState; case KeypressState.WaitingOnKeys: return vimState; } diff --git a/test/configuration/configuration.test.ts b/test/configuration/configuration.test.ts index 7f635b3f580..f64d799f3d2 100644 --- a/test/configuration/configuration.test.ts +++ b/test/configuration/configuration.test.ts @@ -1,43 +1,57 @@ import * as assert from 'assert'; import * as srcConfiguration from '../../src/configuration/configuration'; -import { Globals } from '../../src/globals'; import * as testConfiguration from '../testConfiguration'; -import { reloadConfiguration } from '../testUtils'; +import { cleanUpWorkspace, setupWorkspace } from './../testUtils'; +import { getTestingFunctions } from '../testSimplifier'; +import { ModeName } from '../../src/mode/mode'; suite('Configuration', () => { - suiteSetup(() => { - let configuration = new testConfiguration.Configuration(); - configuration.leader = ''; - configuration.normalModeKeyBindingsNonRecursive = [ - { - before: ['leader', 'o'], - after: ['o', 'eSc', 'k'], - }, - ]; - - configuration.whichwrap = 'h,l'; - - Globals.mockConfiguration = configuration; - reloadConfiguration(); + const { newTest } = getTestingFunctions(); + let configuration = new testConfiguration.Configuration(); + configuration.leader = ''; + configuration.normalModeKeyBindingsNonRecursive = [ + { + before: ['leader', 'o'], + after: ['o', 'eSc', 'k'], + }, + { + before: ['', 'f', 'e', 's'], + after: ['v'], + }, + ]; + configuration.whichwrap = 'h,l'; + + setup(async () => { + await setupWorkspace(configuration); }); + teardown(cleanUpWorkspace); + test('remappings are normalized', async () => { - let configuration = srcConfiguration.configuration; - let keybindings = configuration.normalModeKeyBindingsNonRecursive; + const normalizedKeybinds = srcConfiguration.configuration.normalModeKeyBindingsNonRecursive; + const testingKeybinds = configuration.normalModeKeyBindingsNonRecursive; + + assert.equal(normalizedKeybinds.length, testingKeybinds.length); + assert.deepEqual(normalizedKeybinds[0].before, [' ', 'o']); + assert.deepEqual(normalizedKeybinds[0].after, ['o', '', 'k']); + }); - assert.equal(keybindings.length, 1); - assert.deepEqual(keybindings[0].before, [' ', 'o']); - assert.deepEqual(keybindings[0].after, ['o', '', 'k']); + newTest({ + title: 'Can handle long key chords', + start: ['|'], + keysPressed: ' fes', + end: ['|'], + endMode: ModeName.Visual, }); test('whichwrap is parsed into wrapKeys', async () => { - let configuration = srcConfiguration.configuration; + let wrapKeys = srcConfiguration.configuration.wrapKeys; const h = 'h'; const j = 'j'; - assert.equal(configuration.wrapKeys[h], true); - assert.equal(configuration.wrapKeys[j], undefined); + assert.equal(wrapKeys[h], true); + assert.equal(wrapKeys[j], undefined); }); });