From dfdc45ec54a01852ebac939181d40f63454cad55 Mon Sep 17 00:00:00 2001 From: Nelo Wallus Date: Fri, 15 Jan 2016 14:16:41 +0100 Subject: [PATCH 1/4] Fix applying to parent fold --- plugins/contrib/treestyletabs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/contrib/treestyletabs.js b/plugins/contrib/treestyletabs.js index ece387c4..ff623223 100644 --- a/plugins/contrib/treestyletabs.js +++ b/plugins/contrib/treestyletabs.js @@ -39,8 +39,8 @@ function fold_collapse_expand(collapse, children = false) { let tab = gBrowser.tabContainer.selectedItem; if (!TreeStyleTabService.hasChildTabs(tab)) { - let tab = TreeStyleTabService.getParentTab(tab); - collapse = TreeStyleTabService.isSubtreeCollapsed(tab); + tab = TreeStyleTabService.getParentTab(tab); + gBrowser.tabContainer.selectedIndex = gBrowser.tabContainer.getIndexOfItem(tab); } fold_collapse_expand_target( From 2a5f1fe30e50eac226270b62d9851008479adff3 Mon Sep 17 00:00:00 2001 From: Nelo Wallus Date: Fri, 15 Jan 2016 14:19:39 +0100 Subject: [PATCH 2/4] Add tab{next,previous}visible to jump over folds Required since tab{next,previous} open closed folds --- plugins/contrib/treestyletabs.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/contrib/treestyletabs.js b/plugins/contrib/treestyletabs.js index ff623223..c5cbaf5e 100644 --- a/plugins/contrib/treestyletabs.js +++ b/plugins/contrib/treestyletabs.js @@ -218,3 +218,23 @@ create_command_and_mapping( }, "" ) + +create_command_and_mapping( + "tabnextvisible", + "Switch to the next visible tab", + function () { + let tab = TreeStyleTabService.getNextVisibleTab(gBrowser.tabContainer.selectedItem); + gBrowser.tabContainer.selectedIndex = gBrowser.tabContainer.getIndexOfItem(tab); + }, + "" + ) + +create_command_and_mapping( + "tabpreviousvisible", + "Switch to the previous visible tab", + function () { + let tab = TreeStyleTabService.getPreviousVisibleTab(gBrowser.tabContainer.selectedItem); + gBrowser.tabContainer.selectedIndex = gBrowser.tabContainer.getIndexOfItem(tab); + }, + "" + ) From 4f3a3bd135631c220ee4fed3c8ca3f06b3b6e1e0 Mon Sep 17 00:00:00 2001 From: Nelo Wallus Date: Fri, 15 Jan 2016 14:25:58 +0100 Subject: [PATCH 3/4] Add tabattachto and tabdetachfrom tabattach and tabdetach were already taken. Line 249: For some reason tabs.match() doesn't return a generator in the script as it should while it works in the prompt. So instead we have this. --- plugins/contrib/treestyletabs.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/plugins/contrib/treestyletabs.js b/plugins/contrib/treestyletabs.js index c5cbaf5e..78602797 100644 --- a/plugins/contrib/treestyletabs.js +++ b/plugins/contrib/treestyletabs.js @@ -238,3 +238,32 @@ create_command_and_mapping( }, "" ) + +create_command_and_mapping( + "tabattachto", + "Attach tab as child to another tab", + function (args) { + if (args[0]) { + let tab = gBrowser.tabContainer.selectedItem; + + let parenttab = tabs.getTab(parseInt(args[0], 10) - 1); + + gBrowser.treeStyleTab.attachTabTo(tab, parenttab); + } + }, + "", + { + completer: function (context) { + completion.buffer(context, false); + } + } + ) + +create_command_and_mapping( + "tabdetachfrom", + "Detach tab from parent", + function () { + gBrowser.treeStyleTab.detachTab(gBrowser.tabContainer.selectedItem); + }, + "" + ) From d8caefc53e785b5229462bef75f73a1214f2d572 Mon Sep 17 00:00:00 2001 From: Nelo Wallus Date: Fri, 15 Jan 2016 15:04:57 +0100 Subject: [PATCH 4/4] Add descriptions --- plugins/contrib/treestyletabs.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/contrib/treestyletabs.js b/plugins/contrib/treestyletabs.js index 78602797..a1b73c51 100644 --- a/plugins/contrib/treestyletabs.js +++ b/plugins/contrib/treestyletabs.js @@ -22,6 +22,13 @@ var INFO = [ "project", { name: "Pentadactyl", "min-version": "1.0" } ], + [ + "p", {}, + "A set of commands to be able to properly use TreeStyleTabs with pentadactyl. ", + "Please note that the functions tend to be slow when mapped to keys (this is a ", + "general problem), so if it's too slow for you copy this script and insert the ", + "binds you want in the empty quotes in every create_command_and_mapping(). " + ] ]; // pass true to close, false to open @@ -57,10 +64,22 @@ function fold_collapse_expand_toggle(children = false) { ); } +function info_add_description(tags, description) { + INFO = INFO.concat( + [ + "item", {}, + ["tags", {}, tags], + ["spec", {}, tags], + ["description", {}, ["p", {}, description ]] + ] + ); +} + function create_command_and_mapping(command, description, funcref, mapping, command_option = {}) { group.commands.add([command], description, funcref, command_option, true ); if (mapping != "") group.mappings.add([modes.NORMAL], [mapping], description, funcref); + info_add_description(":" + command + " " + mapping, description); } create_command_and_mapping(