Notes: edit a text file of any size (#47)
CI / build (pull_request) Successful in 1m52s
Site / build (pull_request) Successful in 12s

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
This commit is contained in:
2026-10-07 15:39:45 +02:00
co-authored by Claude Opus 5.5
parent 10c5291e15
commit de8af6ed92
21 changed files with 1681 additions and 111 deletions
+1
View File
@@ -42,6 +42,7 @@ void PowerService::applyScreen(ScreenState state) {
}
void PowerService::powerOff() {
poweringOff_ = true;
if (beforePowerOff) beforePowerOff();
auto& display = M5Cardputer.Display;
display.wakeup();
+2
View File
@@ -28,6 +28,7 @@ class PowerService : public Service {
// Run before the device powers off: the last chance to put on the card what's only in memory.
std::function<void()> beforePowerOff;
bool poweringOff() const { return poweringOff_; } // from beforePowerOff on: no time for long work
private:
void applyScreen(ScreenState state);
@@ -38,6 +39,7 @@ class PowerService : public Service {
PowerButton button_{2000};
ScreenState applied_ = ScreenState::On;
int appliedBrightness_ = -1;
bool poweringOff_ = false;
};
} // namespace roro