atom-keymap
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -34,3 +34,3 @@ (function() { | ||
Keymap.prototype.partialMatchTimeout = 200; | ||
Keymap.prototype.partialMatchTimeout = 1000; | ||
@@ -135,3 +135,3 @@ Keymap.prototype.defaultTarget = null; | ||
Keymap.prototype.handleKeyboardEvent = function(event, replaying) { | ||
var currentTarget, exactMatch, exactMatchCandidates, foundMatch, keystroke, keystrokes, partialMatchCandidates, partialMatches, target, _i, _len, _ref1, _ref2; | ||
var currentTarget, enableTimeout, exactMatch, exactMatchCandidates, foundMatch, keystroke, keystrokes, partialMatchCandidates, partialMatches, target, _i, _len, _ref1, _ref2; | ||
keystroke = this.keystrokeForKeyboardEvent(event); | ||
@@ -151,26 +151,28 @@ if (this.queuedKeystrokes.length > 0 && isAtomModifier(keystroke)) { | ||
partialMatches = this.findPartialMatches(partialMatchCandidates, target); | ||
if (partialMatches.length > 0) { | ||
event.preventDefault(); | ||
return this.enterPendingState(partialMatches); | ||
} else { | ||
if (exactMatchCandidates.length > 0) { | ||
currentTarget = target; | ||
while ((currentTarget != null) && currentTarget !== document) { | ||
_ref2 = this.findExactMatches(exactMatchCandidates, currentTarget); | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
exactMatch = _ref2[_i]; | ||
foundMatch = true; | ||
this.clearQueuedKeystrokes(); | ||
this.cancelPendingState(); | ||
if (this.dispatchCommandEvent(exactMatch.command, target, event)) { | ||
return; | ||
} | ||
if (exactMatchCandidates.length > 0) { | ||
currentTarget = target; | ||
while ((currentTarget != null) && currentTarget !== document) { | ||
_ref2 = this.findExactMatches(exactMatchCandidates, currentTarget); | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
exactMatch = _ref2[_i]; | ||
foundMatch = true; | ||
if (partialMatches.length > 0) { | ||
break; | ||
} | ||
currentTarget = currentTarget.parentElement; | ||
this.clearQueuedKeystrokes(); | ||
this.cancelPendingState(); | ||
if (this.dispatchCommandEvent(exactMatch.command, target, event)) { | ||
return; | ||
} | ||
} | ||
currentTarget = currentTarget.parentElement; | ||
} | ||
if (!foundMatch) { | ||
return this.terminatePendingState(); | ||
} | ||
} | ||
if (partialMatches.length > 0) { | ||
event.preventDefault(); | ||
enableTimeout = foundMatch != null ? foundMatch : this.pendingStateTimeoutHandle != null; | ||
return this.enterPendingState(partialMatches, enableTimeout); | ||
} else { | ||
return this.terminatePendingState(); | ||
} | ||
}; | ||
@@ -313,5 +315,10 @@ | ||
Keymap.prototype.enterPendingState = function(pendingPartialMatches) { | ||
Keymap.prototype.enterPendingState = function(pendingPartialMatches, enableTimeout) { | ||
if (this.pendingStateTimeoutHandle != null) { | ||
this.cancelPendingState(); | ||
} | ||
this.pendingPartialMatches = pendingPartialMatches; | ||
return this.pendingStateTimeoutHandle = setTimeout(this.terminatePendingState.bind(this), this.partialMatchTimeout); | ||
if (enableTimeout) { | ||
return this.pendingStateTimeoutHandle = setTimeout(this.terminatePendingState.bind(this), this.partialMatchTimeout); | ||
} | ||
}; | ||
@@ -321,3 +328,3 @@ | ||
clearTimeout(this.pendingStateTimeoutHandle); | ||
this.pendingStateTimeout = null; | ||
this.pendingStateTimeoutHandle = null; | ||
return this.pendingPartialMatches = null; | ||
@@ -324,0 +331,0 @@ }; |
{ | ||
"name": "atom-keymap", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Atom's DOM-aware keymap module", | ||
@@ -5,0 +5,0 @@ "main": "./lib/keymap", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35981
949