curd-editor 0.1.2

A tiny terminal text editor
curd-editor-0.1.2 is not a library.

curd

A tiny terminal text editor written in Rust with crossterm, built step by step as a learning project.

Package name: curd-editor (curd is taken on crates.io). Command name: curd.

Install

cargo install curd-editor
curd some-file.txt

Prebuilt binaries for Linux, macOS and Windows are on the releases page.

Run

cargo run -- src/main.rs

Arrows / Home / End move the cursor, long files scroll, Ctrl+Q quits.

Test

cargo test                # unit tests + end-to-end tests
cargo llvm-cov            # same, with a coverage report (cargo install cargo-llvm-cov)
  • Unit tests sit next to the code in src/document/tests.rs and src/editor/tests.rs.
  • End-to-end tests in tests/e2e.rs start the real curd in a pseudo-terminal, send keys and check the screen (Linux/macOS only).

Test files are left out of the published crate (see include in Cargo.toml).

CI runs the tests on every push and pull request and saves a JUnit test report and a coverage report as artifacts on the run. Pushing a v* tag runs the same checks first and only publishes a release (GitHub binaries, then crates.io) if they pass.

Layout

  • src/main.rs — starts everything up
  • src/terminal.rs — raw mode, alternate screen, screen size (restored on drop)
  • src/document.rs — the text (lines) and opening files
  • src/editor.rs — main loop, keys, scrolling, drawing

Progress

  • Step 1: raw mode, read keys, Ctrl+Q
  • Step 2: draw the screen with ~ and a welcome message
  • Step 3: open a file and show it (modular refactor)
  • Step 4: cursor movement and vertical scrolling
  • Challenge: PageUp / PageDown
  • Step 5: typing and deleting
  • Step 6: save with Ctrl+S
  • Status bar, search, syntax highlighting, undo
  • LSP: diagnostics → hover → go to definition → completion