mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Improved process of replying via hotkeys for sending messages.
Fixed #30160.
This commit is contained in:
@@ -7736,9 +7736,10 @@ bool HistoryWidget::replyToPreviousMessage() {
|
|||||||
|| (_replyTo && _replyTo.messageId.peer != _history->peer->id)) {
|
|| (_replyTo && _replyTo.messageId.peer != _history->peer->id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto isFieldVisible = _field->isVisible();
|
||||||
const auto fullId = FullMsgId(
|
const auto fullId = FullMsgId(
|
||||||
_history->peer->id,
|
_history->peer->id,
|
||||||
(_field->isVisible()
|
((isFieldVisible && _replyTo.messageId.msg)
|
||||||
? _replyTo.messageId.msg
|
? _replyTo.messageId.msg
|
||||||
: _highlighter.latestSingleHighlightedMsgId()));
|
: _highlighter.latestSingleHighlightedMsgId()));
|
||||||
if (const auto item = session().data().message(fullId)) {
|
if (const auto item = session().data().message(fullId)) {
|
||||||
@@ -7746,8 +7747,12 @@ bool HistoryWidget::replyToPreviousMessage() {
|
|||||||
if (const auto previousView = view->previousDisplayedInBlocks()) {
|
if (const auto previousView = view->previousDisplayedInBlocks()) {
|
||||||
const auto previous = previousView->data();
|
const auto previous = previousView->data();
|
||||||
controller()->showMessage(previous);
|
controller()->showMessage(previous);
|
||||||
if (_field->isVisible()) {
|
if (isFieldVisible) {
|
||||||
replyToMessage(previous);
|
if (previous->isLocal()) {
|
||||||
|
cancelReply();
|
||||||
|
} else {
|
||||||
|
replyToMessage(previous);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -7755,8 +7760,12 @@ bool HistoryWidget::replyToPreviousMessage() {
|
|||||||
} else if (const auto previousView = _history->findLastDisplayed()) {
|
} else if (const auto previousView = _history->findLastDisplayed()) {
|
||||||
const auto previous = previousView->data();
|
const auto previous = previousView->data();
|
||||||
controller()->showMessage(previous);
|
controller()->showMessage(previous);
|
||||||
if (_field->isVisible()) {
|
if (isFieldVisible) {
|
||||||
replyToMessage(previous);
|
if (previous->isLocal()) {
|
||||||
|
cancelReply();
|
||||||
|
} else {
|
||||||
|
replyToMessage(previous);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -7770,9 +7779,10 @@ bool HistoryWidget::replyToNextMessage() {
|
|||||||
|| (_replyTo && _replyTo.messageId.peer != _history->peer->id)) {
|
|| (_replyTo && _replyTo.messageId.peer != _history->peer->id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto isFieldVisible = _field->isVisible();
|
||||||
const auto fullId = FullMsgId(
|
const auto fullId = FullMsgId(
|
||||||
_history->peer->id,
|
_history->peer->id,
|
||||||
(_field->isVisible()
|
((isFieldVisible && _replyTo.messageId.msg)
|
||||||
? _replyTo.messageId.msg
|
? _replyTo.messageId.msg
|
||||||
: _highlighter.latestSingleHighlightedMsgId()));
|
: _highlighter.latestSingleHighlightedMsgId()));
|
||||||
if (const auto item = session().data().message(fullId)) {
|
if (const auto item = session().data().message(fullId)) {
|
||||||
@@ -7780,8 +7790,12 @@ bool HistoryWidget::replyToNextMessage() {
|
|||||||
if (const auto nextView = view->nextDisplayedInBlocks()) {
|
if (const auto nextView = view->nextDisplayedInBlocks()) {
|
||||||
const auto next = nextView->data();
|
const auto next = nextView->data();
|
||||||
controller()->showMessage(next);
|
controller()->showMessage(next);
|
||||||
if (_field->isVisible()) {
|
if (isFieldVisible) {
|
||||||
replyToMessage(next);
|
if (next->isLocal()) {
|
||||||
|
cancelReply();
|
||||||
|
} else {
|
||||||
|
replyToMessage(next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_highlighter.clear();
|
_highlighter.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user