Skip to content
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
Binary file added .DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,14 @@ TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD s
// Return Value:
// - none
TerminalInput::OutputType Terminal::FocusChanged(const bool focused)
{
return _getTerminalInput().HandleFocus(focused);
}
{
if (_isFocused != focused)
{
_isFocused = focused;
return _getTerminalInput().HandleFocus(focused);
}
return {};
}
Comment on lines +786 to +793
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are some whitespace formatting issues here that the Code Health checker will probably complain about. There's a runformat.cmd script in the terminal/tools directory that should fix stuff like this for you automatically.


// Method Description:
// - Invalidates the regions described in the given pattern tree for the rendering purposes
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class Microsoft::Terminal::Core::Terminal final :
til::CoordType _scrollbackLines = 0;
bool _detectURLs = false;
bool _clipboardOperationsAllowed = true;
bool _isFocused = false;

til::size _altBufferSize;
std::optional<til::size> _deferredResize;
Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalCore/TerminalApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ unsigned int Terminal::GetInputCodePage() const noexcept

void Terminal::CopyToClipboard(wil::zwstring_view content)
{
if (_clipboardOperationsAllowed)
// Only allow VT clipboard writes when the terminal has focus
if (_clipboardOperationsAllowed && _isFocused)
{
_pfnCopyToClipboard(content);
}
Expand Down
8 changes: 7 additions & 1 deletion src/host/outputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,13 @@ unsigned int ConhostInternalGetSet::GetInputCodePage() const
// - <none>
void ConhostInternalGetSet::CopyToClipboard(const wil::zwstring_view content)
{
ServiceLocator::LocateGlobals().getConsoleInformation().CopyTextToClipboard(content);
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();

// Only allow VT clipboard writes when the console has focus
if (WI_IsFlagSet(gci.Flags, CONSOLE_HAS_FOCUS))
{
gci.CopyTextToClipboard(content);
}
}

// Routine Description:
Expand Down
Empty file modified tools/bx.cmd
100644 → 100755
Empty file.