Added ability to select links and monospaced text with pressed Alt key.

This commit is contained in:
23rd 2022-01-24 20:21:19 +03:00 committed by John Preston
parent 8bea6776f5
commit 59ed41abfe
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/sticker_set_box.h"
#include "ui/boxes/confirm_box.h"
#include "base/platform/base_platform_info.h"
#include "base/qt/qt_key_modifiers.h"
#include "base/unixtime.h"
#include "mainwindow.h"
#include "mainwidget.h"
@ -1729,6 +1730,9 @@ void InnerWidget::updateSelected() {
} else {
selectingText = false;
}
if (base::IsAltPressed()) {
request.flags &= ~Ui::Text::StateRequest::Flag::LookupLink;
}
dragState = view->textState(itemPoint, request);
lnkhost = view;
if (!dragState.link && itemPoint.x() >= st::historyPhotoLeft && itemPoint.x() < st::historyPhotoLeft + st::msgPhotoSize) {

View File

@ -51,6 +51,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_widget.h"
#include "base/platform/base_platform_info.h"
#include "base/qt/qt_common_adapters.h"
#include "base/qt/qt_key_modifiers.h"
#include "base/unixtime.h"
#include "mainwindow.h"
#include "layout/layout_selection.h"
@ -3352,6 +3353,9 @@ void HistoryInner::mouseActionUpdate() {
} else {
selectingText = false;
}
if (base::IsAltPressed()) {
request.flags &= ~Ui::Text::StateRequest::Flag::LookupLink;
}
dragState = view->textState(m, request);
_dragStateItem = session().data().message(dragState.itemId);
lnkhost = view;

View File

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_list_widget.h"
#include "base/unixtime.h"
#include "base/qt/qt_key_modifiers.h"
#include "history/history_message.h"
#include "history/history_item_components.h"
#include "history/history_item_text.h"
@ -2664,6 +2665,9 @@ void ListWidget::mouseActionUpdate() {
} else {
inTextSelection = false;
}
if (base::IsAltPressed()) {
request.flags &= ~Ui::Text::StateRequest::Flag::LookupLink;
}
const auto dateHeight = st::msgServicePadding.bottom()
+ st::msgServiceFont->height