From f79c6e8dc163da8fde6912bf94c5a3a43305f95f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 30 Sep 2009 19:48:34 +1000 Subject: [PATCH] Rename :tabreattach to :tabattach. As Kris noted this may be better implemented as :tabmove -window. --- common/content/liberator.js | 3 ++- common/content/tabs.js | 19 +++++++++++++------ vimperator/NEWS | 2 +- vimperator/locale/en-US/index.txt | 2 +- vimperator/locale/en-US/tabs.txt | 6 +++--- xulmus/locale/en-US/index.txt | 2 +- xulmus/locale/en-US/tabs.txt | 6 +++--- 7 files changed, 24 insertions(+), 16 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); + } } }); } diff --git a/vimperator/NEWS b/vimperator/NEWS index fc3ea92d..47e745ed 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -19,7 +19,7 @@ know if I like copying bugs) * IMPORTANT: 'popups' now takes a stringlist rather than a number. - * add [c]:tabreattach[c] + * add [c]:tabattach[c] * add [c]:keepalt[c] * add [c]:styledisable[c], [c]:styleenable[c], and [c]:styletoggle[c] * add [c]:sanitize[c], 'sanitizetimespan' and 'sanitizeitems' diff --git a/vimperator/locale/en-US/index.txt b/vimperator/locale/en-US/index.txt index edf9b649..bd0d76ce 100644 --- a/vimperator/locale/en-US/index.txt +++ b/vimperator/locale/en-US/index.txt @@ -250,6 +250,7 @@ section::Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:stopall[c]|| Stop loading all tab pages + ||[c]:style[c]|| Style Vimperator and web sites + ||[c]:tab[c]|| Execute a command and tell it to output in a new tab + +||[c]:tabattach[c]|| Attach the current tab to another window + ||[c]:tabdetach[c]|| Detach current tab to its own window + ||[c]:tabdo[c]|| Execute a command in each tab + ||[c]:tabduplicate[c]|| Duplicate current tab + @@ -259,7 +260,6 @@ section::Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:tabonly[c]|| Close all other tabs + ||[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]:tabreattach[c]|| Reattach the current tab to another window + ||[c]:tabrewind[c]|| Switch to the first tab + ||[c]:time[c]|| Profile a piece of code or run a command multiple times + ||[c]toolbarhide[c]|| Hide the named toolbar + diff --git a/vimperator/locale/en-US/tabs.txt b/vimperator/locale/en-US/tabs.txt index 3ce5fc03..2cd74919 100644 --- a/vimperator/locale/en-US/tabs.txt +++ b/vimperator/locale/en-US/tabs.txt @@ -161,10 +161,10 @@ Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c]. ________________________________________________________________________________ -|:tabrea| |:tabreattach| -||:tabrea[ttach] {window-index} [tab-index]|| + +|:taba| |:tabattach| +||:taba[ttach] {window-index} [tab-index]|| + ________________________________________________________________________________ -Reattach the current tab to another window. {window-index} is an index into the +Attach 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. diff --git a/xulmus/locale/en-US/index.txt b/xulmus/locale/en-US/index.txt index 8cf923a1..a6b2f32e 100644 --- a/xulmus/locale/en-US/index.txt +++ b/xulmus/locale/en-US/index.txt @@ -296,6 +296,7 @@ section::Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:stopall[c]|| Stop loading all tab pages + ||[c]:style[c]|| Style Xulmus and web sites + ||[c]:tab[c]|| Execute a command and tell it to output in a new tab + +||[c]:tabattach[c]|| Attach the current tab to another window + ||[c]:tabdetach[c]|| Detach current tab to its own window + ||[c]:tabdo[c]|| Execute a command in each tab + ||[c]:tabduplicate[c]|| Duplicate current tab + @@ -305,7 +306,6 @@ section::Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:tabonly[c]|| Close all other tabs + ||[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]:tabreattach[c]|| Reattach the current tab to another window + ||[c]:tabrewind[c]|| Switch to the first tab + ||[c]:time[c]|| Profile a piece of code or run a command multiple times + ||[c]toolbarhide[c]|| Hide the named toolbar + diff --git a/xulmus/locale/en-US/tabs.txt b/xulmus/locale/en-US/tabs.txt index 590be804..8d7b36e1 100644 --- a/xulmus/locale/en-US/tabs.txt +++ b/xulmus/locale/en-US/tabs.txt @@ -152,10 +152,10 @@ Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c]. ________________________________________________________________________________ -|:tabrea| |:tabreattach| -||:tabrea[ttach] {window-index} [tab-index]|| + +|:taba| |:tabattach| +||:taba[ttach] {window-index} [tab-index]|| + ________________________________________________________________________________ -Reattach the current tab to another window. {window-index} is an index into the +Attach 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.