notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 29f500cf9428088cb1e486bea2c18f9db3ff42b5
parent e7c7f303e0f490e6e6f93ac8f1d4080903d30258
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 28 Jan 2026 20:08:41 -0800

fix(dave): prevent focus queue wrap-around on navigation

Previously, pressing Ctrl+P at the highest priority item would wrap
around to the lowest priority item, causing "Done" items to appear
before "NeedsInput" items. Now next/prev stop at boundaries instead
of wrapping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/focus_queue.rs | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/crates/notedeck_dave/src/focus_queue.rs b/crates/notedeck_dave/src/focus_queue.rs @@ -135,7 +135,11 @@ impl FocusQueue { return None; } let cur = self.cursor.unwrap_or(0); - let next = (cur + 1) % self.entries.len(); + // Don't wrap around - stay at lowest priority (last index) + if cur >= self.entries.len() - 1 { + return Some(self.entries[cur].session_id); + } + let next = cur + 1; self.cursor = Some(next); Some(self.entries[next].session_id) } @@ -146,7 +150,11 @@ impl FocusQueue { return None; } let cur = self.cursor.unwrap_or(0); - let prev = (cur + self.entries.len() - 1) % self.entries.len(); + // Don't wrap around - stay at highest priority (index 0) + if cur == 0 { + return Some(self.entries[0].session_id); + } + let prev = cur - 1; self.cursor = Some(prev); Some(self.entries[prev].session_id) }