Restore Home/End navigation in the chat list

Home/End jumped to the first/last chat until InnerWidget's key handling
was rewritten from a switch into an if/else chain (in 'Extract chats list
accessibility, fix build'), which carried over only Up/Down and Page
Up/Down and dropped the Home/End cases.

Re-add them, skipping by the actual total row count (which selectSkip()
clamps) instead of the previous 1<<20 constant, so it lands on the first
or last row in both the default list and the filtered/search results.
This commit is contained in:
Reza Bakhshi Laktasaraei
2026-06-26 05:26:08 +03:30
committed by John Preston
parent ded75881b2
commit 54b9a6b41e
@@ -5807,6 +5807,18 @@ bool InnerWidget::processKeyDispatch(QKeyEvent *e) {
selectSkipPage(_visibleBottom - _visibleTop, -1);
} else if (e->key() == Qt::Key_PageDown) {
selectSkipPage(_visibleBottom - _visibleTop, 1);
} else if (e->key() == Qt::Key_Home || e->key() == Qt::Key_End) {
// Jump to the first/last row. selectSkip() clamps the target, so
// skipping by more than the total row count lands on the edge in both
// the default and the filtered (search) list.
const auto rows = int(_collapsedRows.size())
+ _shownList->size()
+ int(_hashtagResults.size())
+ int(_filterResults.size())
+ int(_peerSearchResults.size())
+ int(_previewResults.size())
+ int(_searchResults.size());
selectSkip((e->key() == Qt::Key_End) ? rows : -rows);
} else {
return false;
}