Skip to content

Editor: large-file streaming load/save support #150

@tig

Description

@tig

Summary

Terminal.Gui.TextView exposes control-level Load(string path), Load(Stream), Load(List<Cell>…), and CloseFile(). The naive case (File.ReadAllTextDocument.Text) is trivial helper territory and stays a consumer concern. The streaming / large-file path is not trivial and is a real gap: loading a multi-MB file without materializing the whole string, and the async placement question.

This is the recognized open question specs/decisions.md OPEN-003 ("LoadAsync(Stream) / SaveAsync on Editor vs. on the document"). Editor is intended to functionally replace TextView, and the beta bar already calls for large-file responsiveness (10 MB < 200 ms initial render), so streaming load deserves a tracked decision + implementation.

Scope

  • Resolve OPEN-003: does LoadAsync(Stream) / SaveAsync live on Editor, on TextDocument, or both (control delegates to document)? The rope-backed TextDocument / RopeTextSource is the natural streaming seam.
  • Streaming load that does not allocate the entire file as one string; encoding/BOM + line-ending preservation per DEC-001.
  • SaveAsync round-trips byte-identical except edited lines (DEC-001).
  • Cancellation + progress for very large files; initial render must not block on full load (meets the beta large-file bar).
  • examples/ted uses the streaming load path for File → Open (R9). - Ted should have a progress indicoatr in the stastus bar showing the async loading status.

Definition of done

  • specs/decisions.md OPEN-003 resolved and logged (placement decided).
  • Streaming LoadAsync / SaveAsync implemented at the decided layer; no full-file string materialization on load.
  • DEC-001 line-ending preservation holds across load/save round trip.
  • 10 MB file: initial render < 200 ms (beta DoD); covered by a perf/integration check.
  • specs/file-io/spec.md; specs/public-api.md updated (R8).
  • ted opens large files via the streaming path (R9).
  • Failing-first tests; suites green; perf gate within 3× baseline; dotnet format + jb clean.

Refs: specs/textview-parity-gap/spec.md Gap 6, specs/decisions.md OPEN-003, DEC-001; specs/plan.md Beta Definition of Done (large-file).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions