Skip to content

Commit

Permalink
Port backspace/delete handling from IMP's prettyautocompleter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jun 12, 2014
1 parent 4a8da9a commit 0935219
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions framework/Core/js/prettyautocomplete.js
Expand Up @@ -313,6 +313,19 @@ var PrettyAutocompleter = Class.create({

keyDownHandler: function(e)
{
var tmp;

switch (e.which || e.keyCode || e.charCode) {
case Event.KEY_DELETE:
case Event.KEY_BACKSPACE:
if (!$F(this.input).length &&
(tmp = this.currentEntries().last())) {
this.updateInput(tmp);
e.stop();
return;
}
}

// Check for a comma or enter
if ((e.keyCode == 188 || (this.honorReturn() && e.keyCode == Event.KEY_RETURN)) && !this.p.requireSelection) {
this.processValue();
Expand Down

0 comments on commit 0935219

Please sign in to comment.