mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 15:52:29 +01:00
fixed completions for things like wildmode=list:longest,full
This commit is contained in:
@@ -492,9 +492,8 @@ liberator.CommandLine = function () //{{{
|
|||||||
multilineInputWidget.collapsed = true;
|
multilineInputWidget.collapsed = true;
|
||||||
outputContainer.collapsed = true;
|
outputContainer.collapsed = true;
|
||||||
completionList.hide();
|
completionList.hide();
|
||||||
//htmllist.hide();
|
|
||||||
//htmllist.clear();
|
|
||||||
completions = [];
|
completions = [];
|
||||||
|
this.resetCompletions();
|
||||||
|
|
||||||
setLine("", this.HL_NORMAL);
|
setLine("", this.HL_NORMAL);
|
||||||
},
|
},
|
||||||
@@ -697,8 +696,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
{
|
{
|
||||||
completionStartIndex = 0;
|
completionStartIndex = 0;
|
||||||
completionIndex = -1;
|
completionIndex = -1;
|
||||||
wildIndex = 0;
|
|
||||||
|
|
||||||
completionPrefix = command.substring(0, commandWidget.selectionStart);
|
completionPrefix = command.substring(0, commandWidget.selectionStart);
|
||||||
completionPostfix = command.substring(commandWidget.selectionStart);
|
completionPostfix = command.substring(commandWidget.selectionStart);
|
||||||
var res = liberator.triggerCallback("complete", currentExtendedMode, completionPrefix);
|
var res = liberator.triggerCallback("complete", currentExtendedMode, completionPrefix);
|
||||||
@@ -709,8 +706,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
if (/\bsort\b/.test(liberator.options["wildoptions"]))
|
if (/\bsort\b/.test(liberator.options["wildoptions"]))
|
||||||
completions.sort(function (a, b) String.localeCompare(a[0], b[0]));
|
completions.sort(function (a, b) String.localeCompare(a[0], b[0]));
|
||||||
|
|
||||||
if (hasList)
|
completionList.setItems(completions);
|
||||||
completionList.setItems(completions, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (completions.length == 0)
|
if (completions.length == 0)
|
||||||
@@ -722,9 +718,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasList)
|
|
||||||
completionList.show();
|
|
||||||
|
|
||||||
if (full)
|
if (full)
|
||||||
{
|
{
|
||||||
if (event.shiftKey)
|
if (event.shiftKey)
|
||||||
@@ -743,12 +736,13 @@ liberator.CommandLine = function () //{{{
|
|||||||
// FIXME: this innocent looking line is the source of a big performance
|
// FIXME: this innocent looking line is the source of a big performance
|
||||||
// problem, when keeping <Tab> pressed down, so disable it for now
|
// problem, when keeping <Tab> pressed down, so disable it for now
|
||||||
// liberator.statusline.updateProgress("match " + (completionIndex + 1) + " of " + completions.length);
|
// liberator.statusline.updateProgress("match " + (completionIndex + 1) + " of " + completions.length);
|
||||||
|
|
||||||
liberator.statusline.updateProgress(res);
|
|
||||||
// if the list is hidden, this function does nothing
|
|
||||||
completionList.selectItem(completionIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the following line is not inside if (hasList) for list:longest,full
|
||||||
|
completionList.selectItem(completionIndex);
|
||||||
|
if (hasList)
|
||||||
|
completionList.show();
|
||||||
|
|
||||||
if ((completionIndex == -1 || completionIndex >= completions.length) && !longest) // wrapped around matches, reset command line
|
if ((completionIndex == -1 || completionIndex >= completions.length) && !longest) // wrapped around matches, reset command line
|
||||||
{
|
{
|
||||||
if (full && completions.length > 1)
|
if (full && completions.length > 1)
|
||||||
@@ -1303,29 +1297,33 @@ liberator.ItemList = function (id) //{{{
|
|||||||
|
|
||||||
clear: function () { this.setItems([]); doc.body.innerHTML = ""; },
|
clear: function () { this.setItems([]); doc.body.innerHTML = ""; },
|
||||||
hide: function () { container.collapsed = true; },
|
hide: function () { container.collapsed = true; },
|
||||||
show: function () { container.collapsed = false; this.selectItem(0); /* fixme? */ },
|
show: function () { container.collapsed = false; },
|
||||||
visible: function () { return !container.collapsed; },
|
visible: function () { return !container.collapsed; },
|
||||||
|
|
||||||
|
// if @param selectedItem is given, show the list and select that item
|
||||||
setItems: function (items, selectedItem)
|
setItems: function (items, selectedItem)
|
||||||
{
|
{
|
||||||
listOffset = listIndex = -1;
|
listOffset = listIndex = -1;
|
||||||
completions = items || [];
|
completions = items || [];
|
||||||
if (typeof(selectedItem) != "number")
|
if (typeof(selectedItem) == "number")
|
||||||
selectedItem = -1;
|
{
|
||||||
|
this.selectItem(selectedItem);
|
||||||
this.selectItem(selectedItem);
|
this.show();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// select index, refill list if necessary
|
// select index, refill list if necessary
|
||||||
selectItem: function (index)
|
selectItem: function (index)
|
||||||
{
|
{
|
||||||
if (container.collapsed) // fixme
|
//if (container.collapsed) // fixme
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (index == -1 || index == completions.length) // wrapped around
|
if (index == -1 || index == completions.length) // wrapped around
|
||||||
{
|
{
|
||||||
if (listIndex >= 0)
|
if (listIndex >= 0)
|
||||||
completionElements[listIndex - listOffset].style.backgroundColor = "";
|
completionElements[listIndex - listOffset].style.backgroundColor = "";
|
||||||
|
else // list is shown the first time
|
||||||
|
fill(0);
|
||||||
|
|
||||||
listIndex = index;
|
listIndex = index;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user