From aeaa03954248050776421b88afd891b9da026748 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 8 May 2015 17:36:05 +0300 Subject: [PATCH] cmd+backspace support added --- Telegram/SourceFiles/gui/flattextarea.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp index 458780eca..03c6f98b0 100644 --- a/Telegram/SourceFiles/gui/flattextarea.cpp +++ b/Telegram/SourceFiles/gui/flattextarea.cpp @@ -704,10 +704,16 @@ QMimeData *FlatTextarea::createMimeDataFromSelection() const { void FlatTextarea::keyPressEvent(QKeyEvent *e) { bool shift = e->modifiers().testFlag(Qt::ShiftModifier); + bool macmeta = (cPlatform() == dbipMac) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier); bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), ctrlGood = (ctrl && cCtrlEnter()) || (!ctrl && !shift && !cCtrlEnter()) || (ctrl && shift); bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return); - if (enter && ctrlGood) { + if (macmeta && e->key() == Qt::Key_Backspace) { + QTextCursor tc(textCursor()), start(tc); + start.movePosition(QTextCursor::StartOfLine); + tc.setPosition(start.position(), QTextCursor::KeepAnchor); + tc.removeSelectedText(); + } else if (enter && ctrlGood) { emit submitted(ctrl && shift); } else if (e->key() == Qt::Key_Escape) { emit cancelled();