runtime column: set the column attributes on scan (config delivered at document start has no <html> yet), no scrollbar in columns, unread only above both the read items and what is on screen, a hidden 1 px webview counts as off screen

This commit is contained in:
CRTkafa 2026-09-28 16:42:21 +00:00
parent 48235f38df
commit a600aa3698
2 changed files with 18 additions and 3 deletions

View file

@ -144,8 +144,9 @@ export function isSourcePage(href: string, source: string): boolean {
export type UnreadTracker = {
/**
* The rendered items, top to bottom, and which of them are on screen right now. The first
* non-empty observation is the baseline (read). Later, an id rendered above the topmost read
* id and not on screen is unread; ids below it are older items (read).
* non-empty observation is the baseline (read). Later, an id rendered above both the topmost
* read id and the topmost item on screen is unread (new, not seen yet); ids below are older
* items (read).
*/
observe(ordered: readonly string[], onScreen: ReadonlySet<string>): void;
/** An item came on screen. */
@ -174,12 +175,14 @@ export function createUnreadTracker(): UnreadTracker {
return;
}
const topRead = ordered.findIndex(id => read.has(id));
const topShown = ordered.findIndex(id => onScreen.has(id));
const limit = topShown >= 0 && topRead >= 0 ? Math.min(topRead, topShown) : topRead;
ordered.forEach((id, index) => {
if (read.has(id) || unread.has(id)) {
if (onScreen.has(id) && unread.delete(id)) remember(read, id);
return;
}
if (topRead >= 0 && index < topRead && !onScreen.has(id)) remember(unread, id);
if (limit >= 0 && index < limit && !onScreen.has(id)) remember(unread, id);
else remember(read, id);
});
},