[Button] Merge/Move all tabs from dual-display to single. 双栏时合并所有标签到单栏

When in dual-display mode, move all tabs from the side whitch has fewer tabs to another side. Change the lister to single-display mode.
将标签从较少的一侧移动到另一侧,从而合并为单栏

It is the reverse operation of "Go TABMOVE=split"
这是 “将标签拆分为双栏” 的反向操作

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	cmd.deselect = false;
	var sTab = clickData.func.sourcetab
	var lis = sTab.lister;
	if(lis.dual==0) return;

	var sumleft = lis.tabsleft.count, sumright = lis.tabsright.count;
	var l_r = "right", sum = sumright, selectN = "first", side = " OPENINRIGHT", tabN = "";
	if(sumleft < sumright){
		l_r = "left"; sum = sumleft; selectN = "last"; side = " OPENINLEFT"; tabN = "=0";
	}

	for(var i=0; i<sum; i++)
		{
			cmd.RunCommand('Set FOCUS='+l_r);
			cmd.RunCommand('Go TABSELECT='+selectN+side);
			lis.Update()
			//log(lis.activetab.path)
			cmd.SetSourceTab(lis.activetab);
			cmd.RunCommand('Go TABMOVE'+tabN);
			lis.Update()
			if(lis.dual==0) break;
		}
}

function log(str){DOpus.Output(str,false,true);}

Move all tabs from dual-display to single.dcf (2.1 KB)

双栏时合并所有标签到单栏.dcf (2.1 KB)

1 Like