From bced75ab3fb73ecd4965171e06383f84b8741642 Mon Sep 17 00:00:00 2001 From: teramako Date: Wed, 8 Dec 2010 01:33:58 +0900 Subject: update :mkgroup command to switch the group after made a group --- panorama.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'panorama.js') diff --git a/panorama.js b/panorama.js index 3f1c715..3fb61d1 100644 --- a/panorama.js +++ b/panorama.js @@ -47,7 +47,7 @@ let INFO = <> :mkgroup :mkg :mkgroup! GroupName -

Create new tab group named GroupName.

+

Create new tab group named GroupName. And then, switch to the group.

If specified !, move the current tab to the group.

@@ -428,15 +428,30 @@ let (cmd = commands.get("buffer")) { cmd.completer = function (context) completion.buffer(context, true); } +/** + * make a group and switch to the group + * if add ! (bang), take up the current tab to the group + */ commands.addUserCommand(["mkg[roup]"], "create Group", function (args) { let groupName = args.literalArg; let group = createGroup(groupName); + let currentTab = tabs.getTab(); if (args.bang) { - let currentTab = tabs.getTab(); if (!currentTab.pinned) TV.moveTabTo(currentTab, group.id); } + let apps = appTabs, + child = group.getChild(0); + if (child) { + tabView.GroupItems.setActiveGroupItem(group); + tabView.UI.goToTab(child.tab); + } else if (apps.length == 0) { + group.newTab(); + } else { + tabView.GroupItems.setActiveGroupItem(group); + tabView.UI.goToTab(currentTab.pinned ? currentTab : apps[apps.length - 1]); + } }, { argCount: "1", bang: true, -- cgit v1.2.3