Changeset View
Changeset View
Standalone View
Standalone View
src/TerminalDisplay.cpp
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | 333 | TerminalDisplay::TerminalDisplay(QWidget* parent) | |||
---|---|---|---|---|---|
349 | , _showTerminalSizeHint(true) | 349 | , _showTerminalSizeHint(true) | ||
350 | , _bidiEnabled(false) | 350 | , _bidiEnabled(false) | ||
351 | , _actSel(0) | 351 | , _actSel(0) | ||
352 | , _wordSelectionMode(false) | 352 | , _wordSelectionMode(false) | ||
353 | , _lineSelectionMode(false) | 353 | , _lineSelectionMode(false) | ||
354 | , _preserveLineBreaks(false) | 354 | , _preserveLineBreaks(false) | ||
355 | , _columnSelectionMode(false) | 355 | , _columnSelectionMode(false) | ||
356 | , _autoCopySelectedText(false) | 356 | , _autoCopySelectedText(false) | ||
357 | , _copyTextAsHTML(true) | ||||
hindenburg: we want the default to be true correctly, as it is currently? | |||||
I think it should be opt-in; I think most users, me included, expect that text copied from a terminal emulator is going to be plain/text... ahmadsamir: I think it should be opt-in; I think most users, me included, expect that text copied from a… | |||||
I would prefer to not change the default from what it is now . If they don't like the current way this works, they change change this setting. hindenburg: I would prefer to not change the default from what it is now . If they don't like the current… | |||||
357 | , _middleClickPasteMode(Enum::PasteFromX11Selection) | 358 | , _middleClickPasteMode(Enum::PasteFromX11Selection) | ||
358 | , _scrollbarLocation(Enum::ScrollBarRight) | 359 | , _scrollbarLocation(Enum::ScrollBarRight) | ||
359 | , _scrollFullPage(false) | 360 | , _scrollFullPage(false) | ||
360 | , _wordCharacters(QStringLiteral(":@-./_~")) | 361 | , _wordCharacters(QStringLiteral(":@-./_~")) | ||
361 | , _bellMode(Enum::NotifyBell) | 362 | , _bellMode(Enum::NotifyBell) | ||
362 | , _allowBlinkingText(true) | 363 | , _allowBlinkingText(true) | ||
363 | , _allowBlinkingCursor(false) | 364 | , _allowBlinkingCursor(false) | ||
364 | , _textBlinking(false) | 365 | , _textBlinking(false) | ||
▲ Show 20 Lines • Show All 2738 Lines • ▼ Show 20 Line(s) | 3103 | { | |||
3103 | _autoCopySelectedText = enabled; | 3104 | _autoCopySelectedText = enabled; | ||
3104 | } | 3105 | } | ||
3105 | 3106 | | |||
3106 | void TerminalDisplay::setMiddleClickPasteMode(Enum::MiddleClickPasteModeEnum mode) | 3107 | void TerminalDisplay::setMiddleClickPasteMode(Enum::MiddleClickPasteModeEnum mode) | ||
3107 | { | 3108 | { | ||
3108 | _middleClickPasteMode = mode; | 3109 | _middleClickPasteMode = mode; | ||
3109 | } | 3110 | } | ||
3110 | 3111 | | |||
3112 | void TerminalDisplay::setCopyTextAsHTML(bool enabled) | ||||
3113 | { | ||||
3114 | _copyTextAsHTML = enabled; | ||||
3115 | } | ||||
3116 | | ||||
3111 | void TerminalDisplay::copyToX11Selection() | 3117 | void TerminalDisplay::copyToX11Selection() | ||
3112 | { | 3118 | { | ||
3113 | if (_screenWindow == nullptr) { | 3119 | if (_screenWindow == nullptr) { | ||
3114 | return; | 3120 | return; | ||
3115 | } | 3121 | } | ||
3116 | 3122 | | |||
3117 | 3123 | | |||
3118 | QString text = _screenWindow->selectedText(currentDecodingOptions()); | 3124 | const QString &text = _screenWindow->selectedText(currentDecodingOptions()); | ||
3119 | if (text.isEmpty()) { | 3125 | if (text.isEmpty()) { | ||
3120 | return; | 3126 | return; | ||
3121 | } | 3127 | } | ||
3122 | QString html = _screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml); | | |||
3123 | 3128 | | |||
3124 | auto mimeData = new QMimeData; | 3129 | auto mimeData = new QMimeData; | ||
3125 | mimeData->setText(text); | 3130 | mimeData->setText(text); | ||
3126 | mimeData->setHtml(html); | 3131 | | ||
3132 | if (_copyTextAsHTML) { | ||||
3133 | mimeData->setHtml(_screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml)); | ||||
3134 | } | ||||
3127 | 3135 | | |||
3128 | if (QApplication::clipboard()->supportsSelection()) { | 3136 | if (QApplication::clipboard()->supportsSelection()) { | ||
3129 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection); | 3137 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection); | ||
3130 | } | 3138 | } | ||
3131 | 3139 | | |||
3132 | if (_autoCopySelectedText) { | 3140 | if (_autoCopySelectedText) { | ||
3133 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | 3141 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | ||
3134 | } | 3142 | } | ||
3135 | } | 3143 | } | ||
3136 | 3144 | | |||
3137 | void TerminalDisplay::copyToClipboard() | 3145 | void TerminalDisplay::copyToClipboard() | ||
3138 | { | 3146 | { | ||
3139 | if (_screenWindow == nullptr) { | 3147 | if (_screenWindow == nullptr) { | ||
3140 | return; | 3148 | return; | ||
3141 | } | 3149 | } | ||
3142 | 3150 | | |||
3143 | QString text = _screenWindow->selectedText(currentDecodingOptions()); | 3151 | const QString &text = _screenWindow->selectedText(currentDecodingOptions()); | ||
3144 | if (text.isEmpty()) { | 3152 | if (text.isEmpty()) { | ||
3145 | return; | 3153 | return; | ||
3146 | } | 3154 | } | ||
3147 | QString html = _screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml); | | |||
3148 | 3155 | | |||
3149 | auto mimeData = new QMimeData; | 3156 | auto mimeData = new QMimeData; | ||
3150 | mimeData->setText(text); | 3157 | mimeData->setText(text); | ||
3151 | mimeData->setHtml(html); | 3158 | | ||
3159 | if (_copyTextAsHTML) { | ||||
3160 | mimeData->setHtml(_screenWindow->selectedText(currentDecodingOptions() | Screen::ConvertToHtml)); | ||||
3161 | } | ||||
3152 | 3162 | | |||
3153 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | 3163 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | ||
3154 | } | 3164 | } | ||
3155 | 3165 | | |||
3156 | void TerminalDisplay::pasteFromClipboard(bool appendEnter) | 3166 | void TerminalDisplay::pasteFromClipboard(bool appendEnter) | ||
3157 | { | 3167 | { | ||
3158 | QString text = QApplication::clipboard()->text(QClipboard::Clipboard); | 3168 | QString text = QApplication::clipboard()->text(QClipboard::Clipboard); | ||
3159 | doPaste(text, appendEnter); | 3169 | doPaste(text, appendEnter); | ||
▲ Show 20 Lines • Show All 570 Lines • Show Last 20 Lines |
we want the default to be true correctly, as it is currently?