pattern-match mode
*/
handleKeyDown: function (inSender, inEvent) {
- var that = this;
+ var that = this,
+ keyCode = inEvent.keyCode;
// remember the last 10 key presses
- this._keyBufferArray.push(inEvent.keyCode);
+ this._keyBufferArray.push(keyCode);
this._keyBufferArray = this._keyBufferArray.slice(-10);
// not working
if (this.$.postbooks.isNotifyPopupShowing()) {
- this.$.postbooks.notifyKey(inEvent.keyCode, inEvent.shiftKey);
+ this.$.postbooks.notifyKey(keyCode, inEvent.shiftKey);
return;
}
+ if (keyCode === 189) {
+ // XXX FIXME hack. Dashes aren't coming through as dashes from my keyboard
+ keyCode = '-'.charCodeAt(0);
+ }
if (inEvent.altKey) {
inEvent.cancelBubble = true;
inEvent.returnValue = false;
- this.processHotKey(inEvent.keyCode);
+ this.processHotKey(keyCode);
return true;
}
if (this._keyBufferEndPattern) {
// we're in record mode, so record.
- this._keyBuffer = this._keyBuffer + String.fromCharCode(inEvent.keyCode);
+ this._keyBuffer = this._keyBuffer + String.fromCharCode(keyCode);
}
if (this._keyBufferEndPattern &&
} else if (this._keyBufferEndPattern &&
_.isEqual(this._keyBufferArray.slice(-1 * this._keyBufferEndPattern.length), this._keyBufferEndPattern)) {
+
+ // first slice the end pattern off the payload
+ this._keyBuffer = this._keyBuffer.substring(0, this._keyBuffer.length - this._keyBufferEndPattern.length);
+
// we've matched an end pattern. Send the recorded buffer to the appropriate method
this[this._keyBufferMethod](this._keyBuffer);
this._keyBuffer = "";