Skip to content

Sonny: Home goes to the first turn, and Ctrl+F finds what pages let go hold - #364

Merged
lydakis merged 7 commits into
mainfrom
claude/project-thread-sk7on4
Oct 29, 2026
Merged

lydakis merged 7 commits into
mainfrom
claude/project-thread-sk7on4

Conversation

@lydakis

@lydakis lydakis commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Requested by George · project thread

These are the last two steps of the "lay out only near the view" design (https://claude.ai/artifact/D2xq91EoAQbqbUmStaZo2L), built on #353.

Home goes to the first turn

  • On the full screen, pressing Home with an empty composer goes up to the conversation's first turn, and End comes back to the newest. When something is typed, both keys still move the cursor in the composer.
  • On the way up, Sonny doesn't draw the pages above the first one. It reads their items once, only to work out which call results belong to older pages, using the same pairing that drawing a page would give (unpaired).
  • Each of those pages stands as blank rows, sized from the average rows per item of the pages drawn so far. A page is drawn for real once the view comes near it, and the view stays put when the true height replaces the guess.
  • The first page is drawn right away.
  • The walk reads 400 nodes per history_nodes call and cuts them into pages of 50. The daemon's lineage check costs time in proportion to how deep from is, so asking for 50 at a time made the walk grow roughly with the square of the history.
  • It reads about 32 pages between frames.
  • Any key or a turn of the wheel stops it. If a read comes back short, the rest loads page by page as before, and a failed read stops the walk.
  • On a screen that has trimmed its oldest rows, Home reloads from the newest page and walks up from there.

Ctrl+F finds what pages let go hold

  • When you step older or newer, Sonny first draws again any pages that were let go between the current match and the next one, nearest page first. That includes pages past the wrap, when the step goes round from one end to the other. Each page is looked through once per step, so matches in those pages are found too.
  • When nothing was found before the step, it lands on the nearest match to the view in the direction asked.
  • The find bar says "looking further" while this runs. Esc stops it, and so does typing or pasting new text.
  • An empty query draws nothing.
  • While a step runs, the pages near the view wait. A page that was just searched is never the one let go to make room, so a match stays in place once it's found.
  • Pages never fetched are not searched, as before.

Measured

On a 2,000-turn store at 200×50:

Time RSS
Home → first turn, drawing every page on the way (first try) 14.6 s 61 MB
Home → first turn, this PR 1.0 s 33 MB
Ctrl+F from the newest turn to turn 1500, after Home and End 3.2 s 48 MB
Ctrl+F from the newest turn to turn 20, the whole way 15 s 61 MB

Searching the whole history costs about 80 ms per page, because each page is drawn exactly. A follow-up could check the raw items for the query before drawing a page, if 15 s turns out to matter. I left that out because rendering changes the text (markdown is stripped and labels are added), so a raw-text check could miss matches.

Starting from the top, I paged down slowly through all 2,000 turns, and they came in order with no gaps. After merging main (#326, #308, #310), I checked Home, End and Ctrl+F on the same store again.

Tests

  • a_page_only_read_gives_back_what_drawing_it_would
  • pages_put_above_blank_wait_for_the_view_and_are_drawn_in_place
  • find_draws_the_pages_let_go_on_the_way_to_the_next_place
  • find_goes_round_through_the_pages_let_go_past_the_last_place
  • find_from_nothing_found_lands_on_the_nearest_place_that_way
  • cargo test -p sonny passes (429 tests). cargo clippy --all-targets -D warnings and cargo fmt --check are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi

On the full screen, Home with an empty composer goes up to the
conversation's first turn. On the way the pages over it are only read,
400 nodes at a time, for what their calls returned: they stand as blank
rows as tall as the pages drawn so far suggest, and are drawn once the
view nears them. The first page is drawn at once. A key or the wheel
stops the way up. End goes back to the newest rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi
@lydakis lydakis self-assigned this Oct 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T07:16:43.294618Z e349286 New commits
🔒 Security Review ✅ Completed 2026-10-29T07:17:32.909358Z e349286 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b79e0fc42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/main.rs Resolved
…lace

Stepping older or newer, the pages let go between the place found and
the next one are drawn again first, the nearest first, each looked
through once, so what they hold is found too. The find bar says it is
looking further meanwhile, and Esc stops it. A page drawn again is not
let go at once to make room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi
@lydakis lydakis changed the title Sonny: Home with nothing typed goes to the first turn, End to the newest Sonny: Home goes to the first turn, and Ctrl+F finds what pages let go hold Oct 29, 2026
Once the rows a long window wrote passed what is kept, the oldest went
and the rows over them were no longer asked for, so Home stopped there.
Now Home draws the conversation anew from its newest page and goes up
from there. A repaint drawn from the newest page puts the welcome over
it only once it is known to start the conversation, as attaching does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77d0fe7b5e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/screen.rs Resolved
Comment thread sonny/src/main.rs Resolved
Comment thread sonny/src/main.rs Resolved
…e way up

Stepping past the newest (or oldest) place now also looks through the
pages let go on the far side, the way finding goes round in the rows
drawn. A failed history read during the walk to the first turn stops
the walk instead of asking again at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi
With no place found yet, the pages drawn on the way leave the position
past the last place. Stepping then picks the nearest place to the view
in the direction asked, and the pages still to draw are looked for from
the view too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5ad3810d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/main.rs Resolved
Comment thread sonny/src/main.rs Resolved
Comment thread sonny/src/screen.rs Resolved
Typing or pasting into the find bar ends a step still looking for the
last text. Nothing typed draws no pages. While a step is under way, the
pages near the view wait, so the one just looked through is not let go
before its place is shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGDkoLb9JSjmwGBPeUi
@lydakis
lydakis merged commit dda2830 into main Oct 29, 2026
4 checks passed
lydakis pushed a commit that referenced this pull request Oct 29, 2026
@lydakis lydakis mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants