summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-09-17 10:19:58 +0000
committerGitHub <noreply@github.com>2021-09-17 10:19:58 +0000
commite118f3882d54a6f84885ab492704104848e5d346 (patch)
treed65763df4d31d87fa030f9d40992ab9f5ced09ef /src/timeline/TimelineModel.cpp
parentAdded a text field that allows choosing custom homeserver in "Room directory"... (diff)
parentImprovements for linking to events (diff)
downloadnheko-e118f3882d54a6f84885ab492704104848e5d346.tar.xz
Merge pull request #728 from Thulinma/goto
Improvements for linking to events
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index e03c32a7..00f6d9df 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -1534,11 +1534,25 @@ void TimelineModel::showEvent(QString eventId) { using namespace std::chrono_literals; - if (idToIndex(eventId) != -1) { + // Direct to eventId + if (eventId[0] == '$') { + int idx = idToIndex(eventId); + if (idx == -1) { + nhlog::ui()->warn("Scrolling to event id {}, failed - no known index", + eventId.toStdString()); + return; + } eventIdToShow = eventId; emit scrollTargetChanged(); showEventTimer.start(50ms); + return; } + // to message index + eventId = indexToId(eventId.toInt()); + eventIdToShow = eventId; + emit scrollTargetChanged(); + showEventTimer.start(50ms); + return; } void