Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
8b38d587
Commit
8b38d587
authored
Jun 25, 2021
by
Jonah Brüchert
🍪
Committed by
Ahmad Samir
Jun 26, 2021
Browse files
Fix copying html from the terminal
parent
9cf7a59f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/terminalDisplay/TerminalClipboard.cpp
View file @
8b38d587
...
...
@@ -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
());
}
void
copyToX11Selection
(
const
QString
&
textToCopy
,
bool
isHtml
,
bool
autoCopySelectedText
)
void
copyToX11Selection
(
const
QString
&
textToCopy
,
const
QString
&
htmlToCopy
,
bool
autoCopySelectedText
)
{
if
(
textToCopy
.
isEmpty
())
{
return
;
...
...
@@ -150,8 +150,8 @@ void copyToX11Selection(const QString &textToCopy, bool isHtml, bool autoCopySel
auto
mimeData
=
new
QMimeData
;
mimeData
->
setText
(
textToCopy
);
if
(
isHtml
)
{
mimeData
->
setHtml
(
text
ToCopy
);
if
(
!
htmlToCopy
.
isEmpty
()
)
{
mimeData
->
setHtml
(
html
ToCopy
);
}
if
(
QApplication
::
clipboard
()
->
supportsSelection
())
{
...
...
src/terminalDisplay/TerminalClipboard.h
View file @
8b38d587
...
...
@@ -47,6 +47,6 @@ QStringList checkForUnsafeCharacters(const QString &text);
*/
bool
isUnsafe
(
const
QChar
c
);
void
copyToX11Selection
(
const
QString
&
textToCopy
,
bool
copyAsHtml
,
bool
autoCopySelectedText
);
void
copyToX11Selection
(
const
QString
&
textToCopy
,
const
QString
&
htmlToCopy
,
bool
autoCopySelectedText
);
}
src/terminalDisplay/TerminalDisplay.cpp
View file @
8b38d587
...
...
@@ -2181,11 +2181,10 @@ void TerminalDisplay::copyToX11Selection()
return
;
}
const
auto
&
text
=
_copyTextAsHTML
?
_screenWindow
->
selectedText
(
currentDecodingOptions
()
|
Screen
::
ConvertToHtml
)
:
_screenWindow
->
selectedText
(
currentDecodingOptions
());
const
auto
text
=
_screenWindow
->
selectedText
(
currentDecodingOptions
());
const
auto
html
=
_screenWindow
->
selectedText
(
currentDecodingOptions
()
|
Screen
::
ConvertToHtml
);
terminalClipboard
::
copyToX11Selection
(
text
,
_copyTextAsHTML
,
_autoCopySelectedText
);
terminalClipboard
::
copyToX11Selection
(
text
,
html
,
_autoCopySelectedText
);
}
void
TerminalDisplay
::
copyToClipboard
()
...
...
Jonah Brüchert
🍪
@jbbgameich
mentioned in commit
dfda7d53
·
Jul 06, 2021
mentioned in commit
dfda7d53
mentioned in commit dfda7d533644b28ddb22a2df3b47d53425b25eb5
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment