closeTab should accept an index param #9997

Closed
opened 2026-01-31 02:09:39 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Aug 4, 2020).

Similar to the other closetab actions being introduced in #7176.

This is being tracked with the other support for customizing the new-tab dropdown, which will need the ability to specify and action for the "close tab" menu item

Originally created by @zadjii-msft on GitHub (Aug 4, 2020). Similar to the other close*tab* actions being introduced in #7176. This is being tracked with the other support for customizing the new-tab dropdown, which will need the ability to specify and action for the "close tab" menu item
Author
Owner

@KimKiHyuk commented on GitHub (Aug 21, 2020):

Could you elaborate on it?

I didn't catch why closetab should accept index parameter.

you want to modify CloseTabsAction and _HandleCloseTab like #7176 ?

then, _HandleCloseTab method will be modified like under code

void TerminalPage::_HandleCloseTab(const IInspectable& /*sender*/,
                                       const TerminalApp::ActionEventArgs& args)
{
     if (const auto& realArgs = actionArgs.ActionArgs().try_as<TerminalApp::CloseTabArgs>())
     {
            uint32_t index = realArgs.Index(); // do you want to get it?

            _CloseFocusedTab();
             args.Handled(true);
      }
}
@KimKiHyuk commented on GitHub (Aug 21, 2020): Could you elaborate on it? I didn't catch why closetab should accept index parameter. you want to modify ```CloseTabsAction``` and ```_HandleCloseTab``` like #7176 ? then, ```_HandleCloseTab``` method will be modified like under code ```cpp void TerminalPage::_HandleCloseTab(const IInspectable& /*sender*/, const TerminalApp::ActionEventArgs& args) { if (const auto& realArgs = actionArgs.ActionArgs().try_as<TerminalApp::CloseTabArgs>()) { uint32_t index = realArgs.Index(); // do you want to get it? _CloseFocusedTab(); args.Handled(true); } } ```
Author
Owner

@zadjii-msft commented on GitHub (Aug 25, 2020):

@KimKiHyuk Pretty much yea - except, it'll be more like how it's implemented in #7390. So the implementation would be more like:

void TerminalPage::_HandleCloseTab(const IInspectable& /*sender*/,
                                       const TerminalApp::ActionEventArgs& args)
{
    if (const auto& realArgs = actionArgs.ActionArgs().try_as<TerminalApp::CloseTabArgs>())
    {
        if (realArgs.Index()) {
            // The user provided an `index`

            const auto index = realArgs.Index().Value();
            const bool handled = _CloseTheNthTab(index); // TODO: This function would need to be implemented of course
            args.Handled(handled); 
        }
        else
        {
            // No index was provided - close the currently active tab.
            _CloseFocusedTab();
             args.Handled(true);
        }
    }
}
@zadjii-msft commented on GitHub (Aug 25, 2020): @KimKiHyuk Pretty much yea - except, it'll be more like how it's implemented in #7390. So the implementation would be more like: ```cpp void TerminalPage::_HandleCloseTab(const IInspectable& /*sender*/, const TerminalApp::ActionEventArgs& args) { if (const auto& realArgs = actionArgs.ActionArgs().try_as<TerminalApp::CloseTabArgs>()) { if (realArgs.Index()) { // The user provided an `index` const auto index = realArgs.Index().Value(); const bool handled = _CloseTheNthTab(index); // TODO: This function would need to be implemented of course args.Handled(handled); } else { // No index was provided - close the currently active tab. _CloseFocusedTab(); args.Handled(true); } } }
Author
Owner

@ghost commented on GitHub (Jul 14, 2021):

:tada:This issue was addressed in #10447, which has now been successfully released as Windows Terminal Preview v1.10.1933.0.🎉

Handy links:

@ghost commented on GitHub (Jul 14, 2021): :tada:This issue was addressed in #10447, which has now been successfully released as `Windows Terminal Preview v1.10.1933.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.10.1933.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9997