From 4f768140c110db79215f7f06cd5cb15d5f7f6eb9 Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Sun, 4 Jun 2023 01:01:53 -0500 Subject: [PATCH] Disallow Focus positioning to Empty lists #1097 (#1104) * Disallow Focus positioning to Empty lists #1097 * Disallow Focus positioning to Empty lists #1097 --- firmware/application/recent_entries.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/application/recent_entries.hpp b/firmware/application/recent_entries.hpp index bdd92772..3048679f 100644 --- a/firmware/application/recent_entries.hpp +++ b/firmware/application/recent_entries.hpp @@ -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);