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
+6 -2
View File
@@ -1914,12 +1914,16 @@ void UITask::onMessageArrived(const UiEvent& ev) {
}
// On screen: a conversation left open under the lock or a dark display isn't read.
bool UITask::threadInView() const {
return !_asleep && !locked() && _screen == SCR_THREAD;
}
bool UITask::isViewingChannel(uint8_t channel_idx) {
return !_asleep && !locked() && _screen == SCR_THREAD && _thread_is_channel && _thread_channel == channel_idx;
return threadInView() && _thread_is_channel && _thread_channel == channel_idx;
}
bool UITask::isViewingDM(const uint8_t* pub_key) {
return !_asleep && !locked() && _screen == SCR_THREAD && !_thread_is_channel && memcmp(_thread_key, pub_key, 4) == 0;
return threadInView() && !_thread_is_channel && memcmp(_thread_key, pub_key, 4) == 0;
}
// ── Status bar + toast (top layer, over every screen) ─────────────────────────
@@ -430,6 +430,7 @@ private:
void buildThread();
void threadOpenAt(int first);
void reopenThreadIfUnread();
bool threadInView() const; // a thread on a lit, unlocked screen
void refreshThread();
void refreshThreadAges();
uint32_t threadSignature() const;