mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 05:58:03 +01:00
Closes issue #681.
This commit is contained in:
@@ -1093,15 +1093,17 @@ var CommandLine = Module("commandline", {
|
||||
.filter(function (c) c.incomplete
|
||||
|| c.hasItems && c.items.length),
|
||||
|
||||
// TODO: Remove.
|
||||
get completion() {
|
||||
let str = commandline.command;
|
||||
return str.substring(this.prefix.length, str.length - this.suffix.length);
|
||||
},
|
||||
set completion(completion) {
|
||||
this._completionItem = null;
|
||||
this.previewClear();
|
||||
|
||||
// Change the completion text.
|
||||
// The second line is a hack to deal with some substring
|
||||
// The third line is a hack to deal with some substring
|
||||
// preview corner cases.
|
||||
let value = this.prefix + completion + this.suffix;
|
||||
commandline.widgets.active.command.value = value;
|
||||
@@ -1115,6 +1117,16 @@ var CommandLine = Module("commandline", {
|
||||
this._completion = completion;
|
||||
},
|
||||
|
||||
get completionItem() this._completionItem,
|
||||
set completionItem(tuple) {
|
||||
let value = this.value;
|
||||
if (tuple)
|
||||
value = this.value.substr(0, tuple[0].offset - this.start)
|
||||
+ tuple[0].items[tuple[1]].result;
|
||||
this.completion = value;
|
||||
this._completionItem = tuple;
|
||||
},
|
||||
|
||||
get caret() this.editor.selection.getRangeAt(0).startOffset,
|
||||
set caret(offset) {
|
||||
this.editor.selection.getRangeAt(0).setStart(this.editor.rootElement.firstChild, offset);
|
||||
@@ -1211,6 +1223,7 @@ var CommandLine = Module("commandline", {
|
||||
let cursor = this.selected;
|
||||
if (cursor && cursor[0] == context) {
|
||||
if (cursor[1] >= context.items.length
|
||||
// FIXME:
|
||||
|| this.completion != context.items[cursor[1]].result) {
|
||||
this.selected = null;
|
||||
this.itemList.select(null);
|
||||
@@ -1351,11 +1364,11 @@ var CommandLine = Module("commandline", {
|
||||
if (idx == null || !this.activeContexts.length) {
|
||||
// Wrapped. Start again.
|
||||
this.selected = null;
|
||||
this.completion = this.value;
|
||||
this.completionItem = null;
|
||||
}
|
||||
else {
|
||||
this.selected = idx;
|
||||
this.completion = this.getItem().result;
|
||||
this.completionItem = idx;
|
||||
}
|
||||
|
||||
this.itemList.select(idx, null, position);
|
||||
|
||||
@@ -959,6 +959,7 @@ var Completion = Module("completion", {
|
||||
|
||||
if (/^about:/.test(context.filter))
|
||||
context.fork("about", 6, this, function (context) {
|
||||
context.title = ["about:"];
|
||||
context.generate = function () {
|
||||
return [[k.substr(services.ABOUT.length), ""]
|
||||
for (k in Cc)
|
||||
|
||||
Reference in New Issue
Block a user