Skip to content

Latest commit

 

History

History
59 lines (29 loc) · 2.71 KB

File metadata and controls

59 lines (29 loc) · 2.71 KB

microscope

Most text editors load a file into memory, mutate it, and write it back. This breaks down on large files — a 10 GB log, a 100 GB database dump, a 1 TB dataset.

Microscope takes a different approach. It never modifies the original file. Instead it records edits as a compact, append-only event log. The original file is memory-mapped and treated as immutable storage; the internal text representation is a persistent data structure that shares structure with prior versions rather than copying bytes. Opening a 1 TB file is instantaneous — no bytes are read until you look at them. Saving is instantaneous — nothing is written to the original file until an explicit :w.

The event log is a first-class artifact: small, versioned, and replayable. A future file format will pair the original file with its log as a single unit — the file as the base, the log as the diff — analogous to how Git stores a repository but applied to individual file editing.

screenshot

NOTE

  • a Rust port is available on the claude_rust branch — reduces the line-index footprint from 16 bytes to 8 bytes per line using a tagged pointer (not possible in Go due to GC constraints)

FEATURE SET

  • basic text editor

    • navigate with Left, Right, Up, Down, PgUp, PgDn, Home, End
    • undo redo with Ctrl+U, Ctrl+R
  • instant start-up, instant edit

  • able to handle very large files, potentially even larger than system memory.

  • able to recover from crash

  • able to edit while still loading the file and exit without losing any progress

  • vim-like command mode, search, goto line, etc.

RELEASE MODEL

  • initial release comes with no suffix, e.g. 0.1.7

  • bug fix releases come with suffix, e.g. 0.1.7a, 0.1.7b

  • the latest stable release should be one lower than latest releast with highest suffix. for example, if 0.1.7b is the latest release, then 0.1.6z is the stable release

INTERACTION WITH FILE SYSTEM

  1. use microscope -h for help

  2. when user opens a file using microscope inputfile, the program will create a log file (journal file) stored at <tmp>/microscope_log/<path> where <tmp> is system default temporary folder

  3. when user edit the file, every action will be written to log file.

  4. when exit the program the log file is preserved to export

  5. user can use command :w outputfile to write the current file into a new file, if outputfile is empty, it will overwrite the current file and exit

  6. user use microscope -r inputfile to replay the log to make a new file. the program will write the output to stdout

NOTES

update go.mod directly from github GOPROXY=direct go mod tidy