mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 06:17:58 +01:00
Completion cleanup. Use elem.contentDocument in followLink.
This commit is contained in:
@@ -1045,8 +1045,8 @@ function Buffer() //{{{
|
||||
// artificially "clicks" a link in order to open it
|
||||
followLink: function (elem, where)
|
||||
{
|
||||
var doc = window.content.document;
|
||||
var view = window.document.defaultView;
|
||||
var doc = elem.ownerDocument;
|
||||
var view = doc.defaultView;
|
||||
var offsetX = 1;
|
||||
var offsetY = 1;
|
||||
|
||||
|
||||
@@ -231,14 +231,8 @@ function IO() //{{{
|
||||
return;
|
||||
}
|
||||
|
||||
let lines = [['"' + liberator.version]];
|
||||
|
||||
// FIXME: Use a set/specifiable list here:
|
||||
for (let cmd in commands)
|
||||
{
|
||||
if (cmd.serial)
|
||||
lines.push(cmd.serial().map(commands.commandToString));
|
||||
}
|
||||
let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
|
||||
lines = util.Array.flatten(lines);
|
||||
|
||||
// :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";
|
||||
|
||||
// source a user .vimperatorrc file
|
||||
lines.unshift('"' + liberator.version);
|
||||
lines.push("\nsource! " + filename + ".local");
|
||||
lines.push("\n\" vim: set ft=vimperator:");
|
||||
|
||||
|
||||
@@ -1328,6 +1328,8 @@ function ItemList(id) //{{{
|
||||
return row;
|
||||
}
|
||||
|
||||
function getCompletion(index) completionElements[index - startIndex];
|
||||
|
||||
/**
|
||||
* uses the entries in completions to fill the listbox
|
||||
* does incremental filling to speed up things
|
||||
@@ -1436,7 +1438,7 @@ function ItemList(id) //{{{
|
||||
if (index == -1 || index == completions.length) // wrapped around
|
||||
{
|
||||
if (selIndex >= 0)
|
||||
completionElements[selIndex - startIndex].removeAttribute("selected");
|
||||
getCompletion(selIndex).removeAttribute("selected");
|
||||
else // list is shown the first time
|
||||
fill(0);
|
||||
selIndex = -1;
|
||||
@@ -1454,20 +1456,16 @@ function ItemList(id) //{{{
|
||||
newOffset = Math.max(newOffset, 0);
|
||||
|
||||
if (selIndex > -1)
|
||||
completionElements[selIndex - startIndex].removeAttribute("selected");
|
||||
getCompletion(selIndex).removeAttribute("selected");
|
||||
|
||||
fill(newOffset);
|
||||
selIndex = index;
|
||||
completionElements[index - startIndex].setAttribute("selected", "true");
|
||||
getCompletion(index).setAttribute("selected", "true");
|
||||
|
||||
return;
|
||||
},
|
||||
|
||||
onEvent: function (event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
onEvent: function (event) false
|
||||
};
|
||||
//}}}
|
||||
}; //}}}
|
||||
|
||||
Reference in New Issue
Block a user