diff --git a/src/buffer/out/textBuffer.cpp b/src/buffer/out/textBuffer.cpp index 1fbf1bbea1d..705c8d97777 100644 --- a/src/buffer/out/textBuffer.cpp +++ b/src/buffer/out/textBuffer.cpp @@ -1581,10 +1581,12 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF, // - backgroundColor - default background color for characters, also used in padding // - fontHeightPoints - the unscaled font height // - fontFaceName - the name of the font used -// - htmlTitle - value used in title tag of html header. Used to name the application // Return Value: // - string containing the generated HTML -std::string TextBuffer::GenHTML(const TextAndColor& rows, const int fontHeightPoints, const std::wstring_view fontFaceName, const COLORREF backgroundColor, const std::string& htmlTitle) +std::string TextBuffer::GenHTML(const TextAndColor& rows, + const int fontHeightPoints, + const std::wstring_view fontFaceName, + const COLORREF backgroundColor) { try { @@ -1594,7 +1596,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows, const int fontHeightPo // HTML boiler plate required for CF_HTML // as part of the HTML Clipboard format const std::string htmlHeader = - "" + htmlTitle + ""; + ""; htmlBuilder << htmlHeader; htmlBuilder << ""; diff --git a/src/buffer/out/textBuffer.hpp b/src/buffer/out/textBuffer.hpp index 351444820ba..4b409e7b95f 100644 --- a/src/buffer/out/textBuffer.hpp +++ b/src/buffer/out/textBuffer.hpp @@ -158,8 +158,7 @@ class TextBuffer final static std::string GenHTML(const TextAndColor& rows, const int fontHeightPoints, const std::wstring_view fontFaceName, - const COLORREF backgroundColor, - const std::string& htmlTitle); + const COLORREF backgroundColor); static std::string GenRTF(const TextAndColor& rows, const int fontHeightPoints, diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 55b4d1066bf..79bebbe1705 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -727,7 +727,7 @@ HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& int const iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already const COLORREF bgColor = _terminal->GetBackgroundColor(_terminal->GetDefaultBrushColors()); - std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor, "Hwnd Console Host"); + std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor); _CopyToSystemClipboard(HTMLToPlaceOnClip, L"HTML Format"); std::string RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor); diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index b3ff614757b..44466e62c35 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -2054,11 +2054,13 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } // convert text to HTML format + // GH#5347 - Don't provide a title for the generated HTML, as many + // web applications will paste the title first, followed by the HTML + // content, which is unexpected. const auto htmlData = TextBuffer::GenHTML(bufferData, _actualFont.GetUnscaledSize().Y, _actualFont.GetFaceName(), - _settings.DefaultBackground(), - "Windows Terminal"); + _settings.DefaultBackground()); // convert to RTF format const auto rtfData = TextBuffer::GenRTF(bufferData, diff --git a/src/interactivity/win32/Clipboard.cpp b/src/interactivity/win32/Clipboard.cpp index f6620da7200..6103d573535 100644 --- a/src/interactivity/win32/Clipboard.cpp +++ b/src/interactivity/win32/Clipboard.cpp @@ -277,7 +277,7 @@ void Clipboard::CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, int const iFontHeightPoints = fontData.GetUnscaledSize().Y * 72 / ServiceLocator::LocateGlobals().dpi; const COLORREF bgColor = ServiceLocator::LocateGlobals().getConsoleInformation().GetDefaultBackground(); - std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor, "Windows Console Host"); + std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor); CopyToSystemClipboard(HTMLToPlaceOnClip, L"HTML Format"); std::string RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);