diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index 9b5f739a..3868b2d2 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -352,7 +352,9 @@ Ox.Input = function(options, self) { }; } return ret; - }), + }) + }); + self.$autocompleteMenu.options({ selected: selected }).showMenu(); } else { @@ -378,7 +380,23 @@ Ox.Input = function(options, self) { } //size: self.options.size }) - .bindEvent('click', clickMenu); + .bindEvent({ + click: clickMenu, + key_left: function() { + cursor(cursor()[0] - 1); + }, + key_right: function() { + cursor(cursor()[0] + 1); + }, + key_shift_left: function() { + var cursor = cursor(); + cursor(cursor[0] - 1, cursor[1]); + }, + key_shift_right: function() { + var cursor = cursor(); + cursor(cursor[0], cursor[1] + 1); + } + }); if (self.options.autocompleteReplace) { menu.bindEvent({ deselect: deselectMenu, @@ -632,7 +650,11 @@ Ox.Input = function(options, self) { hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) && oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length; //Ox.print('keypress', event.keyCode) - if (event.keyCode != 9 && (self.options.type == 'textarea' || event.keyCode != 13) && event.keyCode != 27) { // fixme: can't 13 and 27 return false? + if ( + event.keyCode != 9 && + (self.options.type == 'textarea' || event.keyCode != 13) && + event.keyCode != 27 + ) { // fixme: can't 13 and 27 return false? setTimeout(function() { // wait for val to be set var value = self.$input.val(); if (self.options.autocompleteReplaceCorrect && hasDeletedSelectedEnd) { @@ -652,8 +674,12 @@ Ox.Input = function(options, self) { } }, 0); } - if ((event.keyCode == 38 || event.keyCode == 40) && self.options.autocompleteSelect && self.$autocompleteMenu.is(':visible')) { - return false; + if ( + (event.keyCode == 38 || event.keyCode == 40) && + self.options.autocompleteSelect && + self.$autocompleteMenu.is(':visible') + ) { + //return false; } }