2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Ctrl+[1-5] jump to the relevant pinned chat.

This commit is contained in:
John Preston
2018-12-29 17:39:17 +04:00
parent a11ca58f36
commit ea7796dccc
3 changed files with 30 additions and 0 deletions

View File

@@ -2844,6 +2844,25 @@ void DialogsInner::setupShortcuts() {
request->check(Command::ChatLast) && request->handle([=] {
return jumpToDialogRow(last);
});
static const auto kPinned = {
Command::ChatPinned1,
Command::ChatPinned2,
Command::ChatPinned3,
Command::ChatPinned4,
Command::ChatPinned5,
};
auto &&pinned = ranges::view::zip(kPinned, ranges::view::ints(0));
for (const auto [command, index] : pinned) {
request->check(command) && request->handle([=, index = index] {
const auto count = shownPinnedCount();
if (index >= count) {
return false;
}
const auto row = *(shownDialogs()->cbegin() + index);
return jumpToDialogRow({ row->key(), FullMsgId() });
});
}
if (Auth().supportMode() && row.key.history()) {
request->check(
Command::SupportScrollToCurrent