Merge f-t to m-c

This commit is contained in:
Phil Ringnalda 2014-02-16 08:47:19 -08:00
commit b221ac46cb
3 changed files with 40 additions and 29 deletions

View File

@ -136,6 +136,11 @@ CustomizeMode.prototype = {
this._handler.isEnteringCustomizeMode = true;
// Always disable the reset button at the start of customize mode, it'll be re-enabled
// if necessary when we finish entering:
let resetButton = this.document.getElementById("customization-reset-button");
resetButton.setAttribute("disabled", "true");
Task.spawn(function() {
// We shouldn't start customize mode until after browser-delayed-startup has finished:
if (!this.window.gBrowserInit.delayedStartupFinished) {
@ -313,6 +318,11 @@ CustomizeMode.prototype = {
let panelContents = window.PanelUI.contents;
panelContents.setAttribute("customize-transitioning", "true");
// Disable the reset and undo reset buttons while transitioning:
let resetButton = this.document.getElementById("customization-reset-button");
let undoResetButton = this.document.getElementById("customization-undo-reset-button");
undoResetButton.hidden = resetButton.disabled = true;
this._transitioning = true;
Task.spawn(function() {

View File

@ -28,39 +28,34 @@ function setupAutoCompletion(ctx, walker) {
autoSelect: true
});
let cycle = (reverse) => {
if (popup && popup.isOpen) {
cycleSuggestions(ed, reverse == true);
return;
}
return win.CodeMirror.Pass;
};
let keyMap = {
"Tab": cm => {
"Tab": cycle,
"Down": cycle,
"Shift-Tab": cycle.bind(this, true),
"Up": cycle.bind(this, true),
"Enter": () => {
if (popup && popup.isOpen) {
cycleSuggestions(ed);
if (!privates.get(ed).suggestionInsertedOnce) {
privates.get(ed).insertingSuggestion = true;
let {label, preLabel} = popup.getItemAtIndex(0);
let cur = ed.getCursor();
ed.replaceText(label.slice(preLabel.length), cur, cur);
}
popup.hidePopup();
return;
}
return win.CodeMirror.Pass;
},
"Shift-Tab": cm => {
if (popup && popup.isOpen) {
cycleSuggestions(ed, true);
return;
}
return win.CodeMirror.Pass;
},
"Up": cm => {
if (popup && popup.isOpen) {
cycleSuggestions(ed, true);
return;
}
return win.CodeMirror.Pass;
},
"Down": cm => {
if (popup && popup.isOpen) {
cycleSuggestions(ed);
return;
}
return win.CodeMirror.Pass;
},
}
};
keyMap[Editor.accel("Space")] = cm => autoComplete(ctx);
cm.addKeyMap(keyMap);
@ -172,7 +167,6 @@ function onEditorKeypress(ed, event) {
case event.DOM_VK_END:
case event.DOM_VK_BACK_SPACE:
case event.DOM_VK_DELETE:
case event.DOM_VK_RETURN:
private.doNotAutocomplete = true;
private.popup.hidePopup();
break;

View File

@ -49,7 +49,7 @@ let TEST_CASES = [
['VK_RETURN', -1],
['b', 2, 0],
['u', 1, 0],
['VK_TAB', -1],
['VK_RETURN', -1, 0, 1],
['{', -1],
['VK_HOME', -1],
['VK_DOWN', -1],
@ -147,6 +147,13 @@ function checkState() {
}
else {
ok(!gPopup.isOpen, "Popup is closed for index " + index);
if (inserted) {
let { preLabel, label } = gPopup.getItemAtIndex(current);
let { line, ch } = gEditor.getCursor();
let lineText = gEditor.getText(line);
is(lineText.substring(ch - label.length, ch), label,
"Current suggestion from the popup is inserted into the editor.");
}
}
index++;
testState();