You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Editing a source file over 256 KB replaces it with the truncated preview and loses its tail #124
Windows, Rust 1.99.1, NoteCraft 0.0.9 at 33429876e885613f6ff8f29a762b15b2be736401 (current main when tested). Verified against the real workspace libraries / front end with synthetic files and an isolated profile. No product source changes or mocks.
Reproduction
Create a CMGFM page with a 300,000-character body and a recognizable END_SENTINEL at the end.
Open Page source and select index.md.
Type one character in the source editor.
Read the actual file from disk, including its length and end marker.
This was reproduced end to end with NoteCraftApp, a real Session, set_show_source(true), egui frames and an Event::Text("Z") sent to the source widget. The app's actual write handler wrote the resulting file; this is not just a parser round-trip hypothesis.
Actual result
BEFORE bytes=300139 tail=true
AFTER bytes=262191 tail=false warning_saved=true
The file tail is removed. The UI-only notice ... the rest of this file is not shown here. becomes literal saved page content. The edit occurs on each change; no explicit destructive-save confirmation is required.
A focused real codeview::show probe also shows the mechanism: the view loads 262,190 bytes (prefix plus notice), keeps PageFile editable, and returns a 262,191-byte replacement after one typed character.
Expected result
A preview limit must never become a destructive edit limit. Either load the complete supported file before enabling editing, or make a truncated preview read-only and explicitly offer a safe way to edit the complete file. Preserve the original file's unseen bytes and keep display notices out of saved data. Cover SVG, ink and Mermaid source too, since they share the editable branch.
Cause
codeview.rs calls read_for_view, appends the notice when cut, then permits editing based only on Kind::editable(). Out::wrote contains the truncated text. app.rs writes that replacement over the whole file.
This is separate from #55's return-from-source editing problem and #113's 50 MB page-size boundary.
Duplicate check
Checked all open/closed issues and PRs, including the first audit's #102-#116 and new PRs #117-#120. No existing issue or PR covering this specific behavior was found.
Activity