1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 11:27:58 +01:00

Fix error on <C-f> with no completions.

This commit is contained in:
Kris Maglione
2011-10-03 16:03:02 -04:00
parent cebf7c5397
commit ed6f37b2fb

View File

@@ -394,7 +394,6 @@ var CommandMode = Class("CommandMode", {
events: { events: {
input: function CM_onInput(event) { input: function CM_onInput(event) {
util.dumpStack();
if (this.completions) { if (this.completions) {
this.resetCompletions(); this.resetCompletions();
@@ -1229,9 +1228,6 @@ var CommandLine = Module("commandline", {
}, },
nextItem: function nextItem(tuple, offset, noWrap) { nextItem: function nextItem(tuple, offset, noWrap) {
if (!this.activeContexts.length)
return null;
if (tuple === undefined) if (tuple === undefined)
tuple = this.selected; tuple = this.selected;
@@ -1246,7 +1242,7 @@ var CommandLine = Module("commandline", {
let substring = ""; let substring = "";
switch (this.wildtype.replace(/.*:/, "")) { switch (this.wildtype.replace(/.*:/, "")) {
case "": case "":
substring = this.getItem(this.nextItem(null)).result; var cursor = this.nextItem(null);
break; break;
case "longest": case "longest":
if (this.items.length > 1) { if (this.items.length > 1) {
@@ -1255,11 +1251,11 @@ var CommandLine = Module("commandline", {
} }
// Fallthrough // Fallthrough
case "full": case "full":
let item = this.nextItem(); cursor = this.nextItem();
if (item)
substring = this.getItem(item).result;
break; break;
} }
if (cursor)
substring = this.getItem(cursor).result;
// Don't show 1-character substrings unless we've just hit backspace // Don't show 1-character substrings unless we've just hit backspace
if (substring.length < 2 && this.lastSubstring.indexOf(substring) !== 0) if (substring.length < 2 && this.lastSubstring.indexOf(substring) !== 0)
@@ -1760,6 +1756,8 @@ var ItemList = Class("ItemList", {
getRelativeItem: function getRelativeItem(offset, tuple, noWrap) { getRelativeItem: function getRelativeItem(offset, tuple, noWrap) {
let groups = this.activeGroups; let groups = this.activeGroups;
if (!groups.length)
return null;
let group = this.selectedGroup || groups[0]; let group = this.selectedGroup || groups[0];
let start = group.selectedIdx || 0; let start = group.selectedIdx || 0;