Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Ctrl+Break can leave the WSL shell in an unusable state" #18437

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
// Ask the hosting application to give us a new connection.
RestartTerminalRequested.raise(*this, nullptr);
_terminal->HardReset();
return true;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ void Terminal::CreateFromSettings(ICoreSettings settings,
UpdateSettings(settings);
}

void Terminal::HardReset()
{

IStateMachineEngine& baseEngine = _stateMachine->Engine();
const auto lock = LockForReading();
baseEngine.ActionEscDispatch(VTID("c"));
}

// Method Description:
// - Update our internal properties to match the new values in the provided
// CoreSettings object.
Expand Down
3 changes: 3 additions & 0 deletions src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <conattrs.hpp>

#include "../../terminal/adapter/adaptDispatch.hpp"
#include "../../inc/DefaultSettings.h"
#include "../../buffer/out/textBuffer.hpp"
#include "../../renderer/inc/IRenderData.hpp"
Expand Down Expand Up @@ -177,6 +178,8 @@ class Microsoft::Terminal::Core::Terminal final :
void UserScrollViewport(const int viewTop) override;
int GetScrollOffset() noexcept override;

void HardReset();

void TrySnapOnInput() override;
bool IsTrackingMouseInput() const noexcept;
bool ShouldSendAlternateScroll(const unsigned int uiButton, const int32_t delta) const noexcept;
Expand Down
Loading