Highlight word from search query.

This commit is contained in:
John Preston
2024-12-09 14:23:16 +04:00
parent 3957fea5e4
commit 3565215c81
3 changed files with 104 additions and 30 deletions
@@ -696,16 +696,19 @@ void Widget::chosenRow(const ChosenRow &row) {
}
return;
} else if (const auto topic = row.key.topic()) {
auto params = Window::SectionShow(
Window::SectionShow::Way::ClearStack);
params.highlightPart.text = _searchState.query;
if (!params.highlightPart.empty()) {
params.highlightPartOffsetHint = kSearchQueryOffsetHint;
}
if (row.newWindow) {
controller()->showInNewWindow(
Window::SeparateId(topic),
row.message.fullId.msg);
} else {
session().data().saveViewAsMessages(topic->forum(), false);
controller()->showThread(
topic,
row.message.fullId.msg,
Window::SectionShow::Way::ClearStack);
controller()->showThread(topic, row.message.fullId.msg, params);
}
} else if (history
&& row.userpicClick
@@ -742,13 +745,16 @@ void Widget::chosenRow(const ChosenRow &row) {
const auto showAtMsgId = controller()->uniqueChatsInSearchResults()
? ShowAtUnreadMsgId
: row.message.fullId.msg;
auto params = Window::SectionShow(
Window::SectionShow::Way::ClearStack);
params.highlightPart.text = _searchState.query;
if (!params.highlightPart.empty()) {
params.highlightPartOffsetHint = kSearchQueryOffsetHint;
}
if (row.newWindow) {
controller()->showInNewWindow(peer, showAtMsgId);
} else {
controller()->showThread(
history,
showAtMsgId,
Window::SectionShow::Way::ClearStack);
controller()->showThread(history, showAtMsgId, params);
hideChildList();
}
} else if (const auto folder = row.key.folder()) {