From 64b79d00eb94da2cb0183a1c0674e057dd841554 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Thu, 10 Sep 2026 21:31:31 +0200 Subject: [PATCH] fix(ui): wrap-around at both ends of the DM/channel history list Every other list in the UI (contacts, channels, message-pick, the mode tabs) wraps at its ends; the DM and channel history lists were the one exception -- UP at the oldest message (top of the list) just stopped instead of wrapping to the compose row (the list's own bottom-most stop), and DOWN from the compose row didn't wrap back to the oldest either. Both directions now close the loop, same as everywhere else. Co-Authored-By: Claude Sonnet 5 --- .../companion_radio/ui-new/MessagesScreen.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/companion_radio/ui-new/MessagesScreen.h b/examples/companion_radio/ui-new/MessagesScreen.h index caaeef42..bd8c0eb7 100644 --- a/examples/companion_radio/ui-new/MessagesScreen.h +++ b/examples/companion_radio/ui-new/MessagesScreen.h @@ -2304,6 +2304,12 @@ public: _dm_hist_sel++; if (_dm_hist_sel >= _dm_hist_scroll + _hist_visible) _dm_hist_scroll = _dm_hist_sel - _hist_visible + 1; + } else if (_dm_hist_sel == dm_count - 1) { + // Oldest (top of the list) -> wrap to the compose row, the list's + // own bottom-most stop -- same ring-wrap every other list in the UI + // does at its ends, just closing the loop through the compose row + // instead of straight back to index 0. + _dm_hist_sel = -1; } return true; } @@ -2313,6 +2319,10 @@ public: if (_dm_hist_sel < _dm_hist_scroll) _dm_hist_scroll = _dm_hist_sel; } else if (_dm_hist_sel == 0) { _dm_hist_sel = -1; + } else if (_dm_hist_sel == -1 && dm_count > 0) { + // Compose row -> wrap to the oldest message (top of the list). + _dm_hist_sel = dm_count - 1; + _dm_hist_scroll = (dm_count > _hist_visible) ? dm_count - _hist_visible : 0; } return true; } @@ -2388,6 +2398,9 @@ public: else if (_hist_sel >= 0 && _hist_sel < ch_hist_count - 1) { _hist_sel++; if (_hist_sel >= _hist_scroll + _hist_visible) _hist_scroll = _hist_sel - _hist_visible + 1; + } else if (_hist_sel == ch_hist_count - 1) { + // Oldest -> wrap to the compose row, same as the DM history handler. + _hist_sel = -1; } updateChannelUnread(); return true; @@ -2395,6 +2408,11 @@ public: if (c == KEY_DOWN) { if (_hist_sel > 0) { _hist_sel--; if (_hist_sel < _hist_scroll) _hist_scroll = _hist_sel; } else if (_hist_sel == 0) _hist_sel = -1; + else if (_hist_sel == -1 && ch_hist_count > 0) { + // Compose row -> wrap to the oldest message. + _hist_sel = ch_hist_count - 1; + _hist_scroll = (ch_hist_count > _hist_visible) ? ch_hist_count - _hist_visible : 0; + } updateChannelUnread(); return true; }