Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix issue matching a binding ending in a carat #221

Merged
merged 2 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions spec/key-binding-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ describe "KeyBinding", ->
assert.equal(keyBindingArgHelper('a b c').matchesKeystrokes(['a', '^a', 'b', '^b']), 'partial')
assert.equal(keyBindingArgHelper('a b c').matchesKeystrokes(['a', '^a', 'd', '^d']), false)

it "returns 'partial' correctly for bindings that end in ^", ->
assert.equal(keyBindingArgHelper('g a ^').matchesKeystrokes(['g', '^g', 'a', '^a']), 'partial')

it "returns MATCH_TYPES.PENDING_KEYUP for bindings that match and contain a remainder of only keyup events", ->
assert.equal(keyBindingArgHelper('a b ^b').matchesKeystrokes(['a', 'b']), MATCH_TYPES.PENDING_KEYUP)

Expand Down
2 changes: 1 addition & 1 deletion src/key-binding.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class KeyBinding
return false

if isPartialMatch
bindingRemainderContainsOnlyKeyups = false unless bindingKeystroke.startsWith('^')
bindingRemainderContainsOnlyKeyups = false unless isKeyup(bindingKeystroke)

# Bindings that match the beginning of the user's keystrokes are not a match.
# e.g. This is not a match. It would have been a match on the previous keystroke:
Expand Down