Bug 987870 - Fix multiple issue of cycling suggesting and pressing keys with modifiers in an empty inplace editor, r=bgrins

This commit is contained in:
Girish Sharma 2014-03-26 02:16:31 +05:30
Родитель e9da61ad85
Коммит 2f345d01fb
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -720,7 +720,8 @@ InplaceEditor.prototype = {
_cycleCSSSuggestion:
function InplaceEditor_cycleCSSSuggestion(aReverse, aNoSelect)
{
let {label, preLabel} = this.popup.selectedItem;
// selectedItem can be null when nothing is selected in an empty editor.
let {label, preLabel} = this.popup.selectedItem || {label: "", preLabel: ""};
if (aReverse) {
this.popup.selectPreviousItem();
} else {
@ -872,7 +873,7 @@ InplaceEditor.prototype = {
if (this.popup && this.popup.isOpen) {
this.popup.hidePopup();
}
} else if (!cycling) {
} else if (!cycling && !aEvent.metaKey && !aEvent.altKey && !aEvent.ctrlKey) {
this._maybeSuggestCompletion();
}

Просмотреть файл

@ -21,9 +21,11 @@ let brace;
// total items in the popup
// ]
let testData = [
["a", {accelKey: true, ctrlKey: true}, "", -1, 0],
["d", {}, "direction", 0, 3],
["VK_DOWN", {}, "display", 1, 3],
["VK_TAB", {}, "", -1, 10],
["VK_DOWN", {}, "-moz-box", 0, 10],
["n", {}, "none", -1, 0],
["VK_TAB", {shiftKey: true}, "display", -1, 0],
["VK_BACK_SPACE", {}, "", -1, 0],
@ -85,7 +87,8 @@ function checkStateAndMoveOn(index) {
checkState();
});
}
else if (/(right|back_space|escape|return)/ig.test(key)) {
else if (/(right|back_space|escape|return)/ig.test(key) ||
(modifiers.accelKey || modifiers.ctrlKey)) {
info("added event listener for right|escape|back_space|return keys");
editor.input.addEventListener("keypress", function onKeypress() {
if (editor.input) {