From 4a8289d0d50f0bdb89ad44a5baa33edb27a465d3 Mon Sep 17 00:00:00 2001 From: Hideaki Terai Date: Sun, 21 Jun 2026 11:59:51 +0900 Subject: [PATCH] fix: align `m` (mark all read) with the Space reading flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `m` の次フィードへの進み方が Space 送り読み(advanceSpaceReading)と 別ロジックになっており、`m` 直後の `space` が期待どおり連鎖しなかった。 - 次フィードを feedList.refresh() のカーソル都合で決めていた (送り読みの getNextFeedWithUnread とは別の並び順) - firstUnread ではなく entry[0] をプレビューするだけで、既読化も setKeepVisibleFeed も行わない - フォーカスを変えないため、content ペインで m を押した直後の space が 最初の未読をスキップ、または未開封プレビューをスクロールしてしまう m を送り読みフローに統一: markAllAsRead → getNextFeedWithUnread(refresh 前に決定)→ keepVisible 差し替え → refresh → 次フィードの firstUnread を openSelectedEntry で開いて focus=content。 未読フィードが尽きたら focus=feed で "No more unread" を表示。 Co-Authored-By: Claude Opus 4.8 --- src/commands/ui.ts | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/commands/ui.ts b/src/commands/ui.ts index 3eac4fe..3d1dd88 100644 --- a/src/commands/ui.ts +++ b/src/commands/ui.ts @@ -924,22 +924,41 @@ export async function cmdUi(): Promise { unifiedList.toggleReadSelected(); }); - // m: フォーカスに関わらず選択中フィードの全記事を既読にし、次のフィードへ移動 + // m: フォーカスに関わらず選択中フィードの全記事を既読にし、 + // 送り読み(Space)と同じロジックで次の未読フィードを開いて読み始める screen.key(['m'], () => { if (searchMode || modalOpen) return; - const feedId = entryList.getCurrentFeedId(); - if (feedId == null) return; + const currentFeedId = entryList.getCurrentFeedId(); + if (currentFeedId == null) return; entryList.markAllAsRead(); - feedList.refresh(); // 既読0になったフィードが消え、カーソルが次フィードへ移動 - // 移動先のフィードをエントリー一覧にも反映 - const sel = feedList.getSelected(); - if (sel?.type === 'feed' && sel.feed) { - entryList.loadFeed(sel.feed.id); - previewSelectedEntry(); - } else if (sel?.type === 'pinned') { - entryList.loadPinned(); - previewSelectedEntry(); + // refresh 前(現フィードがまだ items 上に位置を持つ状態)で次の未読フィードを決める。 + // これにより「先頭から最初の未読」ではなく「現フィードより後の未読」へ進む(送り読みと同一)。 + const nextFeed = feedList.getNextFeedWithUnread(currentFeedId); + + // 既読化したフィードが消えるよう keepVisible を次フィードへ差し替えてから refresh + feedList.setKeepVisibleFeed(nextFeed?.id ?? null); + feedList.refresh(); + + if (!nextFeed) { + focus = 'feed'; + updateFocus(); + setStatus('Marked all as read — no more unread'); + setTimeout(() => resetStatus(), 2000); + return; + } + + // 次の未読フィードへ進み、先頭未読を開いて読み始める(focus=content) + feedList.selectFeedById(nextFeed.id); + entryList.loadFeed(nextFeed.id); + const firstUnread = entryList.firstUnread(); + if (firstUnread) { + focus = 'content'; + updateFocus(); + openSelectedEntry(); + } else { + focus = 'feed'; + updateFocus(); } setStatus('Marked all as read');