diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 9ef08f7d37..c0c23cef07 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1471,6 +1471,10 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) { _widget->onListEscapePressed(); } else if (e == QKeySequence::Copy && !_selected.isEmpty()) { copySelectedText(); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + setToClipboard(getSelectedText(), QClipboard::FindBuffer); +#endif // Q_OS_MAC } else if (e == QKeySequence::Delete) { int32 selectedForForward, selectedForDelete; getSelectionState(selectedForForward, selectedForDelete); diff --git a/Telegram/SourceFiles/ui/flatinput.cpp b/Telegram/SourceFiles/ui/flatinput.cpp index 1ed2ae4fe8..55e088fda7 100644 --- a/Telegram/SourceFiles/ui/flatinput.cpp +++ b/Telegram/SourceFiles/ui/flatinput.cpp @@ -345,6 +345,13 @@ void FlatInput::keyPressEvent(QKeyEvent *e) { emit cancelled(); } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { emit submitted(ctrl && shift); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto selected = selectedText(); + if (!selected.isEmpty() && echoMode() == QLineEdit::Normal) { + QApplication::clipboard()->setText(selected, QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } } @@ -1229,6 +1236,14 @@ void InputArea::InputAreaInner::keyPressEvent(QKeyEvent *e) { e->ignore(); } else if (f()->_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { e->ignore(); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto cursor = textCursor(); + int start = cursor.selectionStart(), end = cursor.selectionEnd(); + if (end > start) { + QApplication::clipboard()->setText(f()->getText(start, end), QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } else { QTextCursor tc(textCursor()); if (enter && ctrl) { @@ -1944,6 +1959,14 @@ void InputField::InputFieldInner::keyPressEvent(QKeyEvent *e) { e->ignore(); } else if (f()->_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { e->ignore(); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto cursor = textCursor(); + int start = cursor.selectionStart(), end = cursor.selectionEnd(); + if (end > start) { + QApplication::clipboard()->setText(f()->getText(start, end), QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } else { QTextCursor tc(textCursor()); if (enter && ctrl) { @@ -2338,6 +2361,13 @@ void MaskedInputField::keyPressEvent(QKeyEvent *e) { emit cancelled(); } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { emit submitted(ctrl && shift); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto selected = selectedText(); + if (!selected.isEmpty() && echoMode() == QLineEdit::Normal) { + QApplication::clipboard()->setText(selected, QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } } diff --git a/Telegram/SourceFiles/ui/flatlabel.cpp b/Telegram/SourceFiles/ui/flatlabel.cpp index 982895d904..ebacebdc84 100644 --- a/Telegram/SourceFiles/ui/flatlabel.cpp +++ b/Telegram/SourceFiles/ui/flatlabel.cpp @@ -304,6 +304,13 @@ void FlatLabel::keyPressEvent(QKeyEvent *e) { onCopySelectedText(); e->accept(); } +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto selection = _selection.empty() ? (_contextMenu ? _savedSelection : _selection) : _selection; + if (!selection.empty()) { + QApplication::clipboard()->setText(_text.originalText(selection, _contextExpandLinksMode), QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } } diff --git a/Telegram/SourceFiles/ui/flattextarea.cpp b/Telegram/SourceFiles/ui/flattextarea.cpp index 3e0d2c3181..ed62bf9399 100644 --- a/Telegram/SourceFiles/ui/flattextarea.cpp +++ b/Telegram/SourceFiles/ui/flattextarea.cpp @@ -1337,6 +1337,15 @@ void FlatTextarea::keyPressEvent(QKeyEvent *e) { } } else if (e->key() == Qt::Key_Search || e == QKeySequence::Find) { e->ignore(); +#ifdef Q_OS_MAC + } else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) { + auto cursor = textCursor(); + int start = cursor.selectionStart(), end = cursor.selectionEnd(); + if (end > start) { + TagList tags; + QApplication::clipboard()->setText(getTextPart(start, end, &tags), QClipboard::FindBuffer); + } +#endif // Q_OS_MAC } else { QTextCursor tc(textCursor()); if (enter && ctrl) {