Skip to content

Commit

Permalink
Bugfix: don't allow closing last tab with middle click (#648)
Browse files Browse the repository at this point in the history
* Bugfix: don't allow closing last tab with middle click
(Also add a few of the TODOs for similar areas)

* Replaced MSFT TODO with GitHub TODO
  • Loading branch information
carlos-zamora authored and miniksa committed May 10, 2019
1 parent 5c70703 commit bf460ab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cascadia/TerminalApp/App.cpp
Expand Up @@ -630,7 +630,7 @@ namespace winrt::TerminalApp::implementation
// reloading settings)
const auto* const p = _settings->FindProfile(tabProfile);

// TODO: MSFT:21268795: Need a better story for what should happen when the last tab is closed.
// TODO: GitHub:627: Need a better story for what should happen when the last tab is closed.
if (p != nullptr && p->GetCloseOnExit() && _tabs.size() > 1)
{
_RemoveTabViewItem(tabViewItem);
Expand Down Expand Up @@ -662,6 +662,7 @@ namespace winrt::TerminalApp::implementation
// - Close the currently focused tab. Focus will move to the left, if possible.
void App::_CloseFocusedTab()
{
// TODO: GitHub:627: Need a better story for what should happen when the last tab is closed.
if (_tabs.size() > 1)
{
int focusedTabIndex = _GetFocusedTabIndex();
Expand Down Expand Up @@ -770,6 +771,7 @@ namespace winrt::TerminalApp::implementation
// - eventArgs: the event's constituent arguments
void App::_OnTabClosing(const IInspectable& sender, const MUX::Controls::TabViewTabClosingEventArgs& eventArgs)
{
// TODO: GitHub:627: Need a better story for what should happen when the last tab is closed.
// Don't allow the user to close the last tab ..
// .. yet.
if (_tabs.size() > 1)
Expand Down Expand Up @@ -826,7 +828,11 @@ namespace winrt::TerminalApp::implementation
{
if (eventArgs.GetCurrentPoint(_root).Properties().IsMiddleButtonPressed())
{
_RemoveTabViewItem(sender);
// TODO: GitHub:627: Need a better story for what should happen when the last tab is closed.
if (_tabs.size() > 1)
{
_RemoveTabViewItem(sender);
}
eventArgs.Handled(true);
}
}
Expand Down

0 comments on commit bf460ab

Please sign in to comment.