Verified Commit dfda7d53 authored by Jonah Brüchert's avatar Jonah Brüchert 💬
Browse files

Revert "Fix copying html from the terminal"

This reverts commit 8b38d587.
parent e844dc6e
...@@ -141,7 +141,7 @@ bool isUnsafe(const QChar c) { ...@@ -141,7 +141,7 @@ bool isUnsafe(const QChar c) {
return (c.category() == QChar::Category::Other_Control && std::find(ALLOWLIST.begin(), ALLOWLIST.end(), c.unicode()) != ALLOWLIST.end()); return (c.category() == QChar::Category::Other_Control && std::find(ALLOWLIST.begin(), ALLOWLIST.end(), c.unicode()) != ALLOWLIST.end());
} }
void copyToX11Selection(const QString &textToCopy, const QString &htmlToCopy, bool autoCopySelectedText) void copyToX11Selection(const QString &textToCopy, bool isHtml, bool autoCopySelectedText)
{ {
if (textToCopy.isEmpty()) { if (textToCopy.isEmpty()) {
return; return;
...@@ -150,8 +150,8 @@ void copyToX11Selection(const QString &textToCopy, const QString &htmlToCopy, bo ...@@ -150,8 +150,8 @@ void copyToX11Selection(const QString &textToCopy, const QString &htmlToCopy, bo
auto mimeData = new QMimeData; auto mimeData = new QMimeData;
mimeData->setText(textToCopy); mimeData->setText(textToCopy);
if (!htmlToCopy.isEmpty()) { if (isHtml) {
mimeData->setHtml(htmlToCopy); mimeData->setHtml(textToCopy);
} }
if (QApplication::clipboard()->supportsSelection()) { if (QApplication::clipboard()->supportsSelection()) {
......
...@@ -47,6 +47,6 @@ QStringList checkForUnsafeCharacters(const QString &text); ...@@ -47,6 +47,6 @@ QStringList checkForUnsafeCharacters(const QString &text);
*/ */
bool isUnsafe(const QChar c); bool isUnsafe(const QChar c);
void copyToX11Selection(const QString &textToCopy, const QString &htmlToCopy, bool autoCopySelectedText); void copyToX11Selection(const QString &textToCopy, bool copyAsHtml, bool autoCopySelectedText);
} }
...@@ -2181,10 +2181,11 @@ void TerminalDisplay::copyToX11Selection() ...@@ -2181,10 +2181,11 @@ void TerminalDisplay::copyToX11Selection()
return; return;
} }
const auto text = _screenWindow->selectedText(currentDecodingOptions()); const auto &text = _copyTextAsHTML ?
const auto html = _screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml); _screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml)
: _screenWindow->selectedText(currentDecodingOptions());
terminalClipboard::copyToX11Selection(text, html, _autoCopySelectedText); terminalClipboard::copyToX11Selection(text, _copyTextAsHTML, _autoCopySelectedText);
} }
void TerminalDisplay::copyToClipboard() void TerminalDisplay::copyToClipboard()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment