summaryrefslogtreecommitdiff
path: root/common/content
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2009-09-30 19:48:34 +1000
committerDoug Kearns <dougkearns@gmail.com>2009-09-30 19:48:34 +1000
commitf79c6e8dc163da8fde6912bf94c5a3a43305f95f (patch)
tree19379966bc4d1bbe6cfff520260d966cadfca799 /common/content
parent422579f6e282b74552aa9e0311646abb719e520d (diff)
downloadpentadactyl-f79c6e8dc163da8fde6912bf94c5a3a43305f95f.tar.gz
Rename :tabreattach to :tabattach.
As Kris noted this may be better implemented as :tabmove -window.
Diffstat (limited to 'common/content')
-rw-r--r--common/content/liberator.js3
-rw-r--r--common/content/tabs.js19
2 files changed, 15 insertions, 7 deletions
diff --git a/common/content/liberator.js b/common/content/liberator.js
index fb47c4d4..4b7d9ad4 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -900,7 +900,8 @@ const liberator = (function () //{{{
completion.window = function window(context) {
context.title = ["Window", "Title"]
- context.completions = [[i, win.document.title] for ([i, win] in Iterator(liberator.windows))];
+ context.keys = { text: function (win) liberator.windows.indexOf(win) + 1, description: function (win) win.document.title };
+ context.completions = liberator.windows;
};
});
diff --git a/common/content/tabs.js b/common/content/tabs.js
index a449f325..e277833a 100644
--- a/common/content/tabs.js
+++ b/common/content/tabs.js
@@ -621,15 +621,15 @@ function Tabs() //{{{
// TODO: match window by title too?
// : accept the full :tabmove arg spec for the tab index arg?
// : better name or merge with :tabmove?
- commands.add(["tabrea[ttach]"],
- "Reattach the current tab to another window",
+ commands.add(["taba[ttach]"],
+ "Attach the current tab to another window",
function (args)
{
if (args.length > 2 || args.some(function (i) i && !/^\d+$/.test(i)))
return void liberator.echoerr("E488: Trailing characters");
- let [winIndex, tabIndex] = args;
- let win = liberator.windows[winIndex];
+ let [winIndex, tabIndex] = args.map(parseInt);
+ let win = liberator.windows[winIndex - 1];
if (!win)
return void liberator.echoerr("Window " + winIndex + " does not exist");
@@ -638,12 +638,16 @@ function Tabs() //{{{
let browser = win.getBrowser();
let dummy = browser.addTab("about:blank");
+ browser.stop();
+ // XXX: the implementation of DnD in tabbrowser.xml suggests
+ // that we may not be guaranteed of having a docshell here
+ // without this reference?
+ browser.docShell;
+
let last = browser.mTabs.length - 1;
browser.moveTabTo(dummy, util.Math.constrain(tabIndex || last, 0, last));
browser.selectedTab = dummy; // required
- browser.stop();
- browser.docShell;
browser.swapBrowsersAndCloseOther(dummy, getBrowser().mCurrentTab);
},
{
@@ -651,7 +655,10 @@ function Tabs() //{{{
completer: function (context, args)
{
if (args.completeArg == 0)
+ {
+ context.filters.push(function ({ item: win }) win != window);
completion.window(context);
+ }
}
});
}