refactor: one place each for "in view" and the keyboard's backspace

ui-new's messagesInView() and ui-lvgl's threadInView() hold the
lit-and-unlocked test the viewing checks repeated; the keyboard's three
copies of the backspace call deleteBeforeCursor(). A stale comment on the
cursor-mode hint goes, onDisplayOn() sits after the view helpers it calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-08 23:58:52 +02:00
co-authored by Claude Opus 5.5
parent 9e24abcbeb
commit d901a58424
7 changed files with 31 additions and 43 deletions
@@ -1063,13 +1063,6 @@ public:
_dm_hist_scroll = 0;
_dm_fs.active = false;
}
// The display came back on over a conversation: what was filed while it was
// dark is unread -- read on from its first message, as on opening.
void onDisplayOn() {
if (_ctx_menu.active) return;
if (_phase == CHANNEL_HIST && !_fs.active && _history.chUnread(_sel_channel_idx) > 0) beginChannelView(_sel_channel_idx);
else if (_phase == DM_HIST && !_dm_fs.active && _task->getDMUnread(_sel_contact.id.pub_key) > 0) beginDmView();
}
void beginChannelView(uint8_t channel_idx) {
_sel_channel_idx = channel_idx;
_unread_at_entry = (int)_history.chUnread(channel_idx);
@@ -1081,6 +1074,13 @@ public:
_hist_sel = _new_idx >= 0 ? _new_idx : _history.histCountForChannel(channel_idx) > 0 ? 0 : -1;
_fs.active = false;
}
// The display came back on over a conversation: what was filed while it was
// dark is unread -- read on from its first message, as on opening.
void onDisplayOn() {
if (_ctx_menu.active) return;
if (_phase == CHANNEL_HIST && !_fs.active && _history.chUnread(_sel_channel_idx) > 0) beginChannelView(_sel_channel_idx);
else if (_phase == DM_HIST && !_dm_fs.active && _task->getDMUnread(_sel_contact.id.pub_key) > 0) beginDmView();
}
// On the first unread (sel), opening: the scroll showing it highest with
// "New" above it (stack(s) lays out from s, sets div_y when "New" fits).