Notes: edit a text file of any size (#47) #81

Merged
twisla merged 1 commits from notes-any-size into main 2026-10-07 13:41:37 +00:00
Owner

For #47: Notes, and e in the Storage App, edit a text file whatever its size.

How

  • The note is the file on the card plus one window in memory (the 16 KB buffer of before, about 8 KB around the cursor) and a list of pieces saying what the rest is made of. notes::NoteDocument, in lib/notes.
  • Up to 64 KB a save rewrites the file, as before. Above, the five-second save appends what changed to <note>.edit; the file itself is rewritten on leaving the note, with a progress bar.
  • After a power cut, opening the note picks the edit up where it was saved. A rewrite that was cut is finished or dropped, never half applied.
  • A file changed elsewhere while edits were waiting: they are kept as <note>.edit.lost.

Also

  • Ctrl with Fn+Up and Fn+Down: the start and the end of the note.
  • The consoles' key command takes ctrl-, alt-, shift- (key ctrl-down).

Checked

  • 507 host tests pass. 15 are new: among them a power cut at every 997th byte of two saves and a rewrite, and 36,000 random keys on six notes compared with a plain string after each.
  • On the device: a 36 KB and a 1.2 MB note edited at both ends and fetched back byte for byte; a restart with unsaved keys; a restart in the middle of the rewrite; a new note; e in Storage. 1.2 MB is rewritten in 2.6 s. Memory with a note open is unchanged (17.5 KB).

Not checked: the power button's path, the screen turning off, a card pulled while editing, memory with IRC connected, the real keyboard's Ctrl with Fn and arrows, a file of tens of megabytes. Renaming or deleting a note from the Storage App leaves its side file behind.

Design and checks: docs/milestones/F1.md, "Notes of any size" (Q223 to Q232).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT

For #47: Notes, and `e` in the Storage App, edit a text file whatever its size. **How** - The note is the file on the card plus one window in memory (the 16 KB buffer of before, about 8 KB around the cursor) and a list of pieces saying what the rest is made of. `notes::NoteDocument`, in `lib/notes`. - Up to 64 KB a save rewrites the file, as before. Above, the five-second save appends what changed to `<note>.edit`; the file itself is rewritten on leaving the note, with a progress bar. - After a power cut, opening the note picks the edit up where it was saved. A rewrite that was cut is finished or dropped, never half applied. - A file changed elsewhere while edits were waiting: they are kept as `<note>.edit.lost`. **Also** - Ctrl with Fn+Up and Fn+Down: the start and the end of the note. - The consoles' `key` command takes `ctrl-`, `alt-`, `shift-` (`key ctrl-down`). **Checked** - 507 host tests pass. 15 are new: among them a power cut at every 997th byte of two saves and a rewrite, and 36,000 random keys on six notes compared with a plain string after each. - On the device: a 36 KB and a 1.2 MB note edited at both ends and fetched back byte for byte; a restart with unsaved keys; a restart in the middle of the rewrite; a new note; `e` in Storage. 1.2 MB is rewritten in 2.6 s. Memory with a note open is unchanged (17.5 KB). **Not checked:** the power button's path, the screen turning off, a card pulled while editing, memory with IRC connected, the real keyboard's Ctrl with Fn and arrows, a file of tens of megabytes. Renaming or deleting a note from the Storage App leaves its side file behind. Design and checks: docs/milestones/F1.md, "Notes of any size" (Q223 to Q232). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla added 1 commit 2026-10-07 13:39:48 +00:00
Notes: edit a text file of any size (#47)
Site / build (pull_request) Successful in 12s
CI / build (pull_request) Successful in 1m52s
de8af6ed92
The editor held the whole note in memory and stopped at 16 KB. It now keeps
a window of the file around the cursor, and the rest on the card as a list
of pieces (notes::NoteDocument). Memory with a note open is what it was.

Up to 64 KB a save rewrites the file, as before. Above, the five-second
save appends what changed to <note>.edit, and the file is rewritten on
leaving the note, with a progress bar. After a power cut, opening the note
picks the edit up where it was saved; a rewrite cut short is finished or
dropped, never half applied.

Also: Ctrl with Fn+Up/Down go to the start and end of the note; the
consoles' `key` command takes ctrl-, alt- and shift-; the Storage App's
`e` no longer refuses a big file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla merged commit dd4e6c31ed into main 2026-10-07 13:41:37 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: twisla/roro9stack#81