Passed PageUp/PageDown from compose search input to results list scroll.

This commit is contained in:
23rd
2026-03-30 11:52:03 +03:00
parent b5b563fdec
commit 8f4b6f80ad
@@ -235,7 +235,8 @@ struct List {
List CreateList(
not_null<Ui::RpWidget*> parent,
not_null<History*> history) {
not_null<History*> history,
rpl::producer<not_null<QKeyEvent*>> scrollKeys) {
auto list = List{
base::make_unique_q<Ui::RpWidget>(parent),
std::make_unique<ListController>(history),
@@ -276,6 +277,16 @@ List CreateList(
p.fillRect(r, st::dialogsBg);
}, list.container->lifetime());
std::move(
scrollKeys
) | rpl::on_next([=](not_null<QKeyEvent*> e) {
const auto delta = scroll->height();
const auto now = scroll->scrollTop();
scroll->scrollToY((e->key() == Qt::Key_PageUp)
? (now - delta)
: (now + delta));
}, scroll->lifetime());
return list;
}
@@ -897,7 +908,13 @@ ComposeSearch::Inner::Inner(
, _history(history)
, _topBar(base::make_unique_q<TopBar>(parent, window, history, from, query))
, _bottomBar(base::make_unique_q<BottomBar>(parent, HasChooseFrom(history)))
, _list(CreateList(parent, history))
, _list(
CreateList(
parent,
history,
_topBar->keyEvents() | rpl::filter([](not_null<QKeyEvent*> e) {
return e->key() == Qt::Key_PageDown || e->key() == Qt::Key_PageUp;
})))
, _apiSearch(history) {
showAnimated();