Repository navigation
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
A long session can only be moved through by line, page or the whole transcript. messages_next/messages_previous exist but are unbound, and they skip any prompt within 10 rows of the viewport top, because they compare against a fixed threshold rather than the row they land on. Assistant parts render without an id the scroll position could be matched against. Bind three levels of navigation by default, all overridable in tui.json: - messages_previous / messages_next (ctrl+up / ctrl+down) stop on every user prompt, now through the same picker as the two below. - messages_landmark_previous / messages_landmark_next (ctrl+shift+up / ctrl+shift+down) stop on prompts, the last text part of each turn (its final response), and question, todowrite and task calls. Edits, reads and shell calls are left out because they are as dense as the blocks themselves. - messages_block_previous / messages_block_next (ctrl+alt+shift+up / ctrl+alt+shift+down) stop on every prompt, text part, reasoning part with content, and tool call. Reasoning without content - an encrypted block or an empty "Thinking" placeholder, which GPT models emit on every step - renders as a bare header and is skipped. Text, reasoning and tool boxes now carry their part id so the session route can find them among the scrollbox children, as it already does for user messages by message id. "Previous" and "next" are relative to the row a navigated block lands on, one below the viewport top, so repeated presses walk block by block; past either end the view goes to the top or back to the bottom. messages_first and messages_last also bind ctrl+home and ctrl+end.
3 of 6 tasks
Nowaker
added a commit
to Nowaker/opencode
that referenced
this pull request
Oct 6, 2026
…+shift Prompt-to-prompt navigation is what ctrl+up/down are for: messages_previous / messages_next take them by default, and block navigation moves to ctrl+alt+shift+up/down. Landmarks keep ctrl+shift+up/down. messages_previous / messages_next now go through the same picker as blocks and landmarks with a "prompt" scope. The vanilla commands skipped any prompt within 10 rows of the viewport top, because they compared against a fixed threshold rather than the row they land on, and scrolled a page when nothing was left; now every prompt is a stop and past either end the view goes to the top or back to the bottom. Matches the amended upstream PR anomalyco#53333. AI-Tool: opencode 1.18.34-vt-89-907b3bc518 AI-Model: anthropic/claude-opus-5-5 AI-Variant: max AI-Platform: linux AI-Harness: Vibeterm bd50370 AI-Session-ID: ses_ef46f1775ffe29MtElYF4DQySL
This was referenced Oct 8, 2026
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Nowaker
added a commit
to Nowaker/opencode
that referenced
this pull request
Oct 11, 2026
…+shift Prompt-to-prompt navigation is what ctrl+up/down are for: messages_previous / messages_next take them by default, and block navigation moves to ctrl+alt+shift+up/down. Landmarks keep ctrl+shift+up/down. messages_previous / messages_next now go through the same picker as blocks and landmarks with a "prompt" scope. The vanilla commands skipped any prompt within 10 rows of the viewport top, because they compared against a fixed threshold rather than the row they land on, and scrolled a page when nothing was left; now every prompt is a stop and past either end the view goes to the top or back to the bottom. Matches the amended upstream PR anomalyco#53333. AI-Tool: opencode 1.18.34-vt-89-907b3bc518 AI-Model: anthropic/claude-opus-5-5 AI-Variant: max AI-Platform: linux AI-Harness: Vibeterm bd50370 AI-Session-ID: ses_ef46f1775ffe29MtElYF4DQySL
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: I'm aware v1 is now the maintenance branch and new features go to v2 only. This PR is here for others who want to use it on v1. I will submit a v2 version once I've migrated my plugin setup to v2.
Issue for this PR
Closes #53331
Type of change
What does this PR do?
Adds three levels of transcript navigation, plus
ctrl+home/ctrl+endfor the existing first/last commands. Every binding is a default thattui.jsoncan override.messages_previous/messages_nextctrl+up/ctrl+down(was unbound)messages_landmark_previous/messages_landmark_nextctrl+shift+up/ctrl+shift+downquestion/todowrite/taskcallsmessages_block_previous/messages_block_nextctrl+alt+shift+up/ctrl+alt+shift+downmessages_first/messages_lastctrl+home/ctrl+endPrompt navigation fix.
messages_previous/messages_nextused to skip any prompt within 10 rows of the viewport top, because they compared prompt positions against a fixed±10threshold rather than the row they land on. With no prompt left they scrolled a page. They now use the same picker as the other two levels, so every prompt is a stop, including short back-to-back turns. Past either end the view goes to the top or back to the bottom.Landmark rule. The final response of a turn is the last non-empty text part before the next user prompt. While a turn is still streaming, its latest text part counts. The landmark tools are:
question: what you were asked and what you answered;todowrite: the plan, as it changed;task: where work was handed to a subagent.Edits, patches, reads, greps and shell calls are not landmarks. A turn is mostly made of them, so stopping on each would make landmark navigation the same as block navigation.
Skipped reasoning. A reasoning part with no text after
[REDACTED]is stripped is skipped. That covers encrypted blocks and GPT's empty "Thinking" placeholders, which render as a bareThought · 1.0sline. It is the same testReasoningPartuses to decide what it shows as content.How it finds blocks. User messages were already rendered with
id={message.id}. This PR gives text, reasoning, inline-tool and block-tool boxesid={part.id}, so the route can match a part to its scrollbox child. Selection lives in a small pure module,src/routes/session/navigation.ts:navigationTargets(messages, parts, scope)returns the set of IDs to stop on forprompt,landmarkorblock.pickNavigationTarget(blocks, anchor, direction)picks the nearest one above or below the anchor row. A part rendered as several boxes, such asapply_patchwith one box per file, counts once, at its first box.The anchor is one row below the viewport top, which is where
messages_nextalready landed a prompt. A block that was just navigated to counts as current, so repeated presses walk one block at a time.The
keymap.test.tsxchange only updates the count of defaultsession.firstbindings from 2 to 3.How did you verify your code works?
test/routes/session/navigation.test.tscovers prompt, block and landmark selection:[REDACTED]reasoning, and whitespace-only text are excluded;bun testandbun typecheckpass inpackages/tui.I imported a 28-message session into isolated
XDG_*dirs. It has 6 full turns, each with an empty GPT-style reasoning placeholder, reasoning with content, text,edit,bash,todowrite, alternatingquestion/task, and a multi-paragraph final response, plus two one-line turns whose prompts are fewer than 10 rows apart. I drove it in a throwaway tmux socket withextended-keys on, sending the keys withtmux send-keys.Screenshots / recordings
The first viewport row after each key, from
tmux capture-pane, starting at the bottom of the session.ctrl+up, before (messages_previousbound toctrl+upintui.json) and after:ctrl+shift+upand thenctrl+alt+shift+up:On
dev(907b3bc518),ctrl+up,ctrl+shift+up,ctrl+alt+shift+up,ctrl+homeandctrl+enddon't change the viewport.home/endwork as before. A draft in the prompt is left untouched; the prompt doesn't bind any of these keys.Checklist
This PR is AI generated, but under direct supervision and on request of @Nowaker.