mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 09:25:45 +01:00
Add :tabreattach.
The name is not very convincing.
This commit is contained in:
@@ -897,6 +897,11 @@ const liberator = (function () //{{{
|
|||||||
context.keys = { text: function (item) item.getAttribute("toolbarname"), description: function () "" };
|
context.keys = { text: function (item) item.getAttribute("toolbarname"), description: function () "" };
|
||||||
context.completions = buffer.evaluateXPath("./*[@toolbarname]", document, toolbox);
|
context.completions = buffer.evaluateXPath("./*[@toolbarname]", document, toolbox);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
completion.window = function window(context) {
|
||||||
|
context.title = ["Window", "Title"]
|
||||||
|
context.completions = [[i, win.document.title] for ([i, win] in Iterator(liberator.windows))];
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
|||||||
@@ -617,6 +617,43 @@ function Tabs() //{{{
|
|||||||
bang: true,
|
bang: true,
|
||||||
count: true
|
count: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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",
|
||||||
|
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];
|
||||||
|
|
||||||
|
if (!win)
|
||||||
|
return void liberator.echoerr("Window " + winIndex + " does not exist");
|
||||||
|
else if (win == window)
|
||||||
|
return void liberator.echoerr("Can't reattach to the same window");
|
||||||
|
|
||||||
|
let browser = win.getBrowser();
|
||||||
|
let dummy = browser.addTab("about:blank");
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
argCount: "+",
|
||||||
|
completer: function (context, args)
|
||||||
|
{
|
||||||
|
if (args.completeArg == 0)
|
||||||
|
completion.window(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (liberator.has("tabs_undo"))
|
if (liberator.has("tabs_undo"))
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
know if I like copying bugs)
|
know if I like copying bugs)
|
||||||
* IMPORTANT: 'popups' now takes a stringlist rather than a number.
|
* IMPORTANT: 'popups' now takes a stringlist rather than a number.
|
||||||
|
|
||||||
|
* add [c]:tabattach[c]
|
||||||
* add [c]:keepalt[c]
|
* add [c]:keepalt[c]
|
||||||
* add [c]:styledisable[c], [c]:styleenable[c], and [c]:styletoggle[c]
|
* add [c]:styledisable[c], [c]:styleenable[c], and [c]:styletoggle[c]
|
||||||
* add [c]:sanitize[c], 'sanitizetimespan' and 'sanitizeitems'
|
* add [c]:sanitize[c], 'sanitizetimespan' and 'sanitizeitems'
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ section::Ex{nbsp}commands[ex-cmd-index,:index]
|
|||||||
||[c]:tabonly[c]|| Close all other tabs +
|
||[c]:tabonly[c]|| Close all other tabs +
|
||||||
||[c]:tabopen[c]|| Open one or more URLs in a new tab +
|
||[c]:tabopen[c]|| Open one or more URLs in a new tab +
|
||||||
||[c]:tabprevious[c]|| Switch to the previous tab or go [count] tabs back +
|
||[c]:tabprevious[c]|| Switch to the previous tab or go [count] tabs back +
|
||||||
|
||[c]:tabreattach[c]|| Reattach the current tab to another window +
|
||||||
||[c]:tabrewind[c]|| Switch to the first tab +
|
||[c]:tabrewind[c]|| Switch to the first tab +
|
||||||
||[c]:time[c]|| Profile a piece of code or run a command multiple times +
|
||[c]:time[c]|| Profile a piece of code or run a command multiple times +
|
||||||
||[c]toolbarhide[c]|| Hide the named toolbar +
|
||[c]toolbarhide[c]|| Hide the named toolbar +
|
||||||
|
|||||||
@@ -160,6 +160,16 @@ contain at least one tab it is not possible to detach the only tab in a window.
|
|||||||
Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c].
|
Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c].
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
|:tabrea| |:tabreattach|
|
||||||
|
||:tabrea[ttach] {window-index} [tab-index]|| +
|
||||||
|
________________________________________________________________________________
|
||||||
|
Reattach the current tab to another window. {window-index} is an index into the
|
||||||
|
list of open windows and [a][tab-index][a] is the index at which to insert the
|
||||||
|
tab in the other window's tab list. If this is the last tab in a window, the
|
||||||
|
window will be closed.
|
||||||
|
________________________________________________________________________________
|
||||||
|
|
||||||
section::Reordering{nbsp}tabs[reordering-tabs]
|
section::Reordering{nbsp}tabs[reordering-tabs]
|
||||||
|
|
||||||
|:tabm| |:tabmove|
|
|:tabm| |:tabmove|
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ section::Ex{nbsp}commands[ex-cmd-index,:index]
|
|||||||
||[c]:tabonly[c]|| Close all other tabs +
|
||[c]:tabonly[c]|| Close all other tabs +
|
||||||
||[c]:tabopen[c]|| Open one or more URLs in a new tab +
|
||[c]:tabopen[c]|| Open one or more URLs in a new tab +
|
||||||
||[c]:tabprevious[c]|| Switch to the previous tab or go [count] tabs back +
|
||[c]:tabprevious[c]|| Switch to the previous tab or go [count] tabs back +
|
||||||
|
||[c]:tabreattach[c]|| Reattach the current tab to another window +
|
||||||
||[c]:tabrewind[c]|| Switch to the first tab +
|
||[c]:tabrewind[c]|| Switch to the first tab +
|
||||||
||[c]:time[c]|| Profile a piece of code or run a command multiple times +
|
||[c]:time[c]|| Profile a piece of code or run a command multiple times +
|
||||||
||[c]toolbarhide[c]|| Hide the named toolbar +
|
||[c]toolbarhide[c]|| Hide the named toolbar +
|
||||||
|
|||||||
@@ -151,6 +151,16 @@ contain at least one tab it is not possible to detach the only tab in a window.
|
|||||||
Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c].
|
Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c].
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
|:tabrea| |:tabreattach|
|
||||||
|
||:tabrea[ttach] {window-index} [tab-index]|| +
|
||||||
|
________________________________________________________________________________
|
||||||
|
Reattach the current tab to another window. {window-index} is an index into the
|
||||||
|
list of open windows and [a][tab-index][a] is the index at which to insert the
|
||||||
|
tab in the other window's tab list. If this is the last tab in a window, the
|
||||||
|
window will be closed.
|
||||||
|
________________________________________________________________________________
|
||||||
|
|
||||||
section::Reordering{nbsp}tabs[reordering-tabs]
|
section::Reordering{nbsp}tabs[reordering-tabs]
|
||||||
|
|
||||||
|:tabm| |:tabmove|
|
|:tabm| |:tabmove|
|
||||||
|
|||||||
Reference in New Issue
Block a user