T12c, T13 review fixes: an emptied lightbox closes through its close path, keys pass over disabled and loading rows, the list cursor follows its row through a re-sort

This commit is contained in:
ZacharyZhang-NY committed 2026-09-25 21:21:33 -04:00
1 parent f8daaf282b
commit 492578a67c
8 files changed
+196 -41

No files matched your search

+3 -3
View File
@@ -9,9 +9,9 @@ use crate::{
primitives::{FocusRing, Image, tab_stop},
};
/// The open picture if it is still there, the last when it went past the end, none when all are gone.
/// The open picture, or the last when it went past the end; with none left the lightbox closes itself.
fn clamp(open: Option<usize>, count: usize) -> Option<usize> {
open.and_then(|at| count.checked_sub(1).map(|last| at.min(last)))
open.map(|at| at.min(count.saturating_sub(1)))
}
/// Pictures in square tiles. A press, or Enter on a focused tile, opens the lightbox at that picture.
@@ -132,7 +132,7 @@ mod tests {
fn an_open_picture_clamps_when_pictures_go_away() {
assert_eq!(clamp(Some(1), 3), Some(1));
assert_eq!(clamp(Some(2), 1), Some(0), "past the end opens the last");
assert_eq!(clamp(Some(0), 0), None, "no pictures closes it");
assert_eq!(clamp(Some(2), 0), Some(0), "the lightbox closes itself");
assert_eq!(clamp(None, 3), None);
}
}