1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 08:08:00 +01:00

Completion cleanup. Use elem.contentDocument in followLink.

This commit is contained in:
Kris Maglione
2008-11-05 17:45:50 +00:00
parent a39226ff23
commit e89c63070b
3 changed files with 10 additions and 17 deletions

View File

@@ -1045,8 +1045,8 @@ function Buffer() //{{{
// artificially "clicks" a link in order to open it // artificially "clicks" a link in order to open it
followLink: function (elem, where) followLink: function (elem, where)
{ {
var doc = window.content.document; var doc = elem.ownerDocument;
var view = window.document.defaultView; var view = doc.defaultView;
var offsetX = 1; var offsetX = 1;
var offsetY = 1; var offsetY = 1;

View File

@@ -231,14 +231,8 @@ function IO() //{{{
return; return;
} }
let lines = [['"' + liberator.version]];
// FIXME: Use a set/specifiable list here: // FIXME: Use a set/specifiable list here:
for (let cmd in commands) let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
{
if (cmd.serial)
lines.push(cmd.serial().map(commands.commandToString));
}
lines = util.Array.flatten(lines); lines = util.Array.flatten(lines);
// :mkvimrc doesn't save autocommands, so we don't either - remove this code at some point // :mkvimrc doesn't save autocommands, so we don't either - remove this code at some point
@@ -250,6 +244,7 @@ function IO() //{{{
// line += "\nlet mapleader = \"" + mappings.getMapLeader() + "\"\n"; // line += "\nlet mapleader = \"" + mappings.getMapLeader() + "\"\n";
// source a user .vimperatorrc file // source a user .vimperatorrc file
lines.unshift('"' + liberator.version);
lines.push("\nsource! " + filename + ".local"); lines.push("\nsource! " + filename + ".local");
lines.push("\n\" vim: set ft=vimperator:"); lines.push("\n\" vim: set ft=vimperator:");

View File

@@ -1328,6 +1328,8 @@ function ItemList(id) //{{{
return row; return row;
} }
function getCompletion(index) completionElements[index - startIndex];
/** /**
* uses the entries in completions to fill the listbox * uses the entries in completions to fill the listbox
* does incremental filling to speed up things * does incremental filling to speed up things
@@ -1436,7 +1438,7 @@ function ItemList(id) //{{{
if (index == -1 || index == completions.length) // wrapped around if (index == -1 || index == completions.length) // wrapped around
{ {
if (selIndex >= 0) if (selIndex >= 0)
completionElements[selIndex - startIndex].removeAttribute("selected"); getCompletion(selIndex).removeAttribute("selected");
else // list is shown the first time else // list is shown the first time
fill(0); fill(0);
selIndex = -1; selIndex = -1;
@@ -1454,20 +1456,16 @@ function ItemList(id) //{{{
newOffset = Math.max(newOffset, 0); newOffset = Math.max(newOffset, 0);
if (selIndex > -1) if (selIndex > -1)
completionElements[selIndex - startIndex].removeAttribute("selected"); getCompletion(selIndex).removeAttribute("selected");
fill(newOffset); fill(newOffset);
selIndex = index; selIndex = index;
completionElements[index - startIndex].setAttribute("selected", "true"); getCompletion(index).setAttribute("selected", "true");
return; return;
}, },
onEvent: function (event) onEvent: function (event) false
{
return false;
}
}; };
//}}} //}}}
}; //}}} }; //}}}