зеркало из https://github.com/mozilla/ubiquity.git
CommandHistory: Fixed argument orders. Reverted the save frequency as it seemed too aggressive. Made Ubiquity reset cursor on hidden.
This commit is contained in:
Родитель
e53575e8e9
Коммит
3b06b3f614
|
@ -169,7 +169,7 @@ Ubiquity.prototype = {
|
|||
if (altKey || event.metaKey) return;
|
||||
|
||||
if (keyCode === this.__KEYCODE_COMPLETE) {
|
||||
if (ctrlKey) this.CommandHistory.complete(this, event.shiftKey);
|
||||
if (ctrlKey) this.CommandHistory.complete(event.shiftKey, this);
|
||||
else {
|
||||
let {completionText} = this.__cmdManager.hilitedSuggestion || 0;
|
||||
if (completionText) this.__textBox.value = completionText;
|
||||
|
@ -178,7 +178,7 @@ Ubiquity.prototype = {
|
|||
}
|
||||
var move = this.__KEYMAP_MOVE_INDICATION[keyCode];
|
||||
if (move) {
|
||||
if (ctrlKey) this.CommandHistory.go(this, keyCode - 39);
|
||||
if (ctrlKey) this.CommandHistory.go(keyCode - 39, this);
|
||||
else this.__cmdManager[move](this.__makeContext());
|
||||
return true;
|
||||
}
|
||||
|
@ -200,10 +200,12 @@ Ubiquity.prototype = {
|
|||
__onblur: function U__onBlur() {
|
||||
gBrowser.mTabBox.handleCtrlTab =
|
||||
!this.__prefs.get("browser.ctrlTab.previews", false);
|
||||
|
||||
this.CommandHistory.add(this.__textBox.value);
|
||||
},
|
||||
|
||||
__onDOMMouseScroll: function U__onMouseScroll(event) {
|
||||
this.CommandHistory.go(this, event.detail > 0 ? 1 : -1);
|
||||
this.CommandHistory.go(event.detail > 0 ? 1 : -1, this);
|
||||
},
|
||||
|
||||
__delayedProcessInput: function U__delayedProcessInput(self, context) {
|
||||
|
@ -215,7 +217,6 @@ Ubiquity.prototype = {
|
|||
self.__lastValue = input,
|
||||
context || self.__makeContext(),
|
||||
self.__onSuggestionsUpdated);
|
||||
self.CommandHistory.add(input);
|
||||
},
|
||||
__processInput: function U__processInput(immediate, context) {
|
||||
clearTimeout(this.__previewTimerID);
|
||||
|
@ -251,6 +252,7 @@ Ubiquity.prototype = {
|
|||
if (unfocused) unfocused.focus();
|
||||
this.__focusedWindow = this.__focusedElement = null;
|
||||
|
||||
this.CommandHistory.cursor = -1;
|
||||
},
|
||||
__onpopupshowing: function U__onShowing() {
|
||||
this.__cmdManager.refresh();
|
||||
|
|
|
@ -62,7 +62,7 @@ function save() {
|
|||
Utils.prefs.set(PREF_BIN, _bin.join(SEPARATOR));
|
||||
return this;
|
||||
}
|
||||
function go(U, num) {
|
||||
function go(num, U) {
|
||||
var {textBox} = U = U || Utils.currentChromeWindow.gUbiquity;
|
||||
var bin = get();
|
||||
if (cursor < 0 && textBox.value) {
|
||||
|
@ -74,13 +74,13 @@ function go(U, num) {
|
|||
U.preview(bin[cursor] || "");
|
||||
return this;
|
||||
}
|
||||
function complete(U, rev) {
|
||||
function complete(rev, U) {
|
||||
var {textBox} = U = U || Utils.currentChromeWindow.gUbiquity;
|
||||
var {value: txt, selectionStart: pos} = textBox, bin = get();
|
||||
if (rev) bin = bin.slice().reverse();
|
||||
pos -= txt.length - (txt = txt.trimLeft()).length;
|
||||
var key = txt.slice(0, pos), re = RegExp("^" + Utils.regexp.quote(key), "i");
|
||||
for (let h, i = bin.indexOf(txt) + 1; h = bin[i++];) if (re.test(h)) {
|
||||
for (let h, i = bin.indexOf(txt); h = bin[++i];) if (re.test(h)) {
|
||||
U.preview(h);
|
||||
textBox.setSelectionRange(key.length, textBox.textLength);
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче