Skip to content

Commit 0ab288a

Browse files
authored
grid alignment in scroll mode (#34)
1 parent 4ff8a1a commit 0ab288a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

webpanel/webpanel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ WebPanel::WebPanel(Instance *instance)
4949
if (!bulkCursor) {
5050
return;
5151
}
52-
return bulkCursor->setGlobalCursorIndex(index);
52+
try {
53+
bulkCursor->setGlobalCursorIndex(index);
54+
} catch (const std::invalid_argument &e) {
55+
FCITX_ERROR() << "highlight candidate index out of range";
56+
}
5357
}
5458
});
5559
window_->set_page_callback([this](bool next) {
@@ -462,10 +466,10 @@ void WebPanel::scroll(int start, int count) {
462466
if (scrollState_ == candidate_window::scroll_state_t::none) {
463467
return;
464468
}
465-
auto ic = instance_->mostRecentInputContext();
466469
if (start < 0) { // collapse
467470
return collapse();
468471
}
472+
auto ic = instance_->mostRecentInputContext();
469473
const auto &list = ic->inputPanel().candidateList();
470474
if (!list) {
471475
return;

0 commit comments

Comments
 (0)