Feature #1699

Add "Close right tabs" menu to TabBar

Added by Abdelghani Omari almost 7 years ago. Updated almost 7 years ago.

Status:ApprovedStart date:04/30/2017
Priority:NormalDue date:
Assignee:Miroslav Fidler% Done:

0%

Category:TabBarSpent time:-
Target version:Release 2017.2

Description

uppsrc\TabBar\TabBar.cpp

void TabBar::ContextMenu(Bar& bar)
{
    if (highlight >= 0 && crosses) {
        bar.Add(tabs.GetCount() > mintabcount, t_("Close"), THISBACK2(Close, highlight, true));
    }
    if (GetCursor() >= 0 && crosses) {
        bar.Add(t_("Close others"), THISBACK1(CloseAll, GetCursor()));

    if (highlight < GetCount()-1 && crosses)                                        // Line ADDED
        bar.Add(t_("Close right tabs"), THISBACK1(CloseRightTabs,highlight));   // Line ADDED
    }

   ...

and the new function


void TabBar::CloseRightTabs(int tab)
{
    if(tab < 0 ) return;

    if(active > tab)
    {
        SetCursor(tab);
    }

    ValueArray vv;
    for(int i = tab+1; i < tabs.GetCount(); i++)
            vv.Add(tabs[i].key);

    if (tab < 0 && CancelCloseAll())
        return;
    else if (tab >= 0 && CancelCloseSome(vv))
        return;

    // 2014/03/06 - FIRST the callbacks, THEN remove the tab
    // otherwise keys in WhenCloseSome() are invalid
    // WhenCloseSome() is called ALWAYS even if all tabs are closed
    WhenCloseSome(vv);

    for(int i = tabs.GetCount() - 1; i > tab; i--)
    {
        TabClosed(tabs[i].key);
        tabs.Remove(i);
    }

    MakeGroups();
    Repos();
    Refresh();
}

History

#1 Updated by Miroslav Fidler almost 7 years ago

  • Status changed from Patch ready to Approved

Used a bit different method...

#2 Updated by Zbigniew Rebacz almost 7 years ago

  • Target version set to Release 2017.2

#3 Updated by Zbigniew Rebacz almost 7 years ago

  • Subject changed from theIde: add "Close right tabs" menu to Add "Close right tabs" menu ti TabBar

#4 Updated by Zbigniew Rebacz almost 7 years ago

  • Subject changed from Add "Close right tabs" menu ti TabBar to Add "Close right tabs" menu to TabBar

Also available in: Atom PDF