Disallow Focus positioning to Empty lists #1097 (#1104)

* Disallow Focus positioning to Empty lists #1097

* Disallow Focus positioning to Empty lists #1097
This commit is contained in:
Mark Thompson 2023-06-04 01:01:53 -05:00 committed by GitHub
parent e5728b3501
commit 4f768140c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,6 @@ class RecentEntriesTable : public Widget {
RecentEntriesTable(
Entries& recent)
: recent{recent} {
set_focusable(true);
}
void paint(Painter& painter) override {
@ -138,6 +137,8 @@ class RecentEntriesTable : public Widget {
Rect target_rect{r.location(), {r.width(), s.font.line_height()}};
const size_t visible_item_count = r.height() / s.font.line_height();
set_focusable(!recent.empty());
auto selected = find(recent, selected_key);
if (selected == std::end(recent)) {
selected = std::begin(recent);