mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:18:00 +01:00
Minor substring completion changes.
This commit is contained in:
@@ -570,9 +570,10 @@ var Editor = Module("editor", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clear(forward, re)
|
function clear(forward, re)
|
||||||
function _clear(editor) {
|
function _clear(editor, elem) {
|
||||||
updateRange(editor, forward, re, function (range) {});
|
updateRange(editor, forward, re, function (range) {});
|
||||||
editor.selection.deleteFromDocument();
|
editor.selection.deleteFromDocument();
|
||||||
|
DOM(elem).input();
|
||||||
}
|
}
|
||||||
|
|
||||||
function move(forward, re)
|
function move(forward, re)
|
||||||
@@ -680,7 +681,7 @@ var Editor = Module("editor", {
|
|||||||
bind(["<C-w>"], "Delete previous word",
|
bind(["<C-w>"], "Delete previous word",
|
||||||
function () {
|
function () {
|
||||||
if (DOM(dactyl.focusedElement).isInput)
|
if (DOM(dactyl.focusedElement).isInput)
|
||||||
clear(false, /\w/)(Editor.getEditor(null));
|
clear(false, /\w/)(Editor.getEditor(null), dactyl.focusedElement);
|
||||||
else
|
else
|
||||||
editor.executeCommand("cmd_deleteWordBackward", 1);
|
editor.executeCommand("cmd_deleteWordBackward", 1);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -553,11 +553,11 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
// of the given string which also matches the current
|
// of the given string which also matches the current
|
||||||
// item's text.
|
// item's text.
|
||||||
let len = substring.length;
|
let len = substring.length;
|
||||||
let i = 0, n = len;
|
let i = 0, n = len + 1;
|
||||||
let result = item.result;
|
let result = n && fixCase(item.result);
|
||||||
while (n) {
|
while (n) {
|
||||||
let m = Math.floor(n / 2);
|
let m = Math.floor(n / 2);
|
||||||
let keep = i + m && compare(fixCase(result), substring.substring(0, i + m));
|
let keep = compare(result, substring.substring(0, i + m));
|
||||||
if (!keep)
|
if (!keep)
|
||||||
len = i + m - 1;
|
len = i + m - 1;
|
||||||
if (!keep || m == 0)
|
if (!keep || m == 0)
|
||||||
|
|||||||
@@ -740,18 +740,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (params.mimeType)
|
if (params.mimeType)
|
||||||
xmlhttp.overrideMimeType(params.mimeType);
|
xmlhttp.overrideMimeType(params.mimeType);
|
||||||
|
|
||||||
if (params.responseType)
|
|
||||||
xmlhttp.responseType = params.responseType;
|
|
||||||
|
|
||||||
xmlhttp.open(params.method || "GET", url, async,
|
xmlhttp.open(params.method || "GET", url, async,
|
||||||
params.user, params.pass);
|
params.user, params.pass);
|
||||||
|
|
||||||
|
if (params.responseType)
|
||||||
|
xmlhttp.responseType = params.responseType;
|
||||||
|
|
||||||
xmlhttp.send(params.data);
|
xmlhttp.send(params.data);
|
||||||
return xmlhttp;
|
return xmlhttp;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (!params.quiet)
|
if (!params.quiet)
|
||||||
util.dactyl.log(_("error.cantOpen", String.quote(url), e), 1);
|
util.reportError(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user