perfectstar2k 0.1.1

A modern TUI homage to WordStar & WordPerfect for DOS — a real writing tool built on WordStar's touch-typist command language and long-hand-page metaphor.
# PerfectStar 2k

A modern TUI homage to **WordStar for DOS** and **WordPerfect 5.1** — a real
daily-driver writing tool, inspired by Robert J. Sawyer's essay
[*A Writer's Word Processor*](https://www.sfwriter.com/wordstar.htm).

Plain text and Markdown in, prose out. WordStar's touch-typist command
language and "long-hand page" metaphor; WordPerfect's clean blue screen and
Reveal Codes; a few of Emacs's best ideas (kill ring, incremental search,
never-lose undo) folded in where they serve a writer.

```
cargo run --release -- draft.md
```

## The philosophy

- **Hands never leave the home row.** Every command is a Ctrl chord with a
  positional mnemonic. Arrow keys, PgUp/PgDn, Home/End also work — WordStar
  itself allowed the same.
- **The long-hand page.** Mark a block now, decide what to do with it hours
  later. Ten bookmarks. A jump ring that remembers where you were. Notes to
  yourself (`..` lines) that display dimmed and never export.
- **Least modal.** Writing and editing are one continuum. No modes to enter,
  no menus to descend for common operations.
- **The tool adapts to the writer.** Config for theme, menu delay, autosave,
  wrap margin, and help levels from hand-holding to a completely clean screen.

## Keys

The diamond (with `^Q…` prefix chords, press the second key plain or with Ctrl):

|       |            |           |            |
|-------|------------|-----------|------------|
| `^E ^S ^D ^X` | cursor diamond | `^A ^F` | word left / right |
| `^W ^Z` | scroll line | `^R ^C` | page up / down |
| `^QS ^QD` | line start / end | `^QE ^QX` | screen top / bottom |
| `^QR ^QC` | document top / bottom | `^Q, ^Q.` | sentence back / forward |
| `^Q[ ^Q]` | paragraph back / forward | `^QP` | previous position (walks the ring) |

Editing:

|       |            |           |            |
|-------|------------|-----------|------------|
| `^G` / `^H` | delete char / left | `^T` | delete word |
| `^Y` | delete line | `^QY` | delete to line end |
| `^U` | undo (never loses a state; redo = undo an undo) | `^N` | open line |
| `^QT` / `^QG` | transpose words / chars | `^V` | insert / overtype |
| `^QM` | record macro | `^QJ` | play macro |

Blocks, bookmarks, and the kill ring:

|       |            |           |            |
|-------|------------|-----------|------------|
| `^KB ^KK` | mark block begin / end — whenever you like | `^KC ^KV` | copy / move block to cursor |
| `^KY` | delete block | `^KH` | hide/show highlight |
| `^KU` | toggle previous block | `^KW ^KR` | write block / read file |
| `^KP` | put a clipping; press again to cycle older ones | `^QB ^QK ^QV` | jump to block begin / end / source |
| `^K0–9` | set bookmark | `^Q0–9` | jump to bookmark |

Search, files, screen:

|       |            |           |            |
|-------|------------|-----------|------------|
| `^QF` | incremental search | `^L` | find next |
| `^QA` | find & replace (g/n/w options) | `Esc` / `F1` | command palette |
| `^KD ^KS` | save (atomic, with one-time `.bak`) | `^KX` | save & exit |
| `^KQ` | quit | `^KE` | export with `..` notes stripped |
| `^OD` | Reveal Codes | `^OB` | cycle theme |
| `^OW ^OR` | word wrap / wrap margin | `^OH` | help level (0 clean · 1 menus · 2 hints) |

Hold any prefix (`^K` `^Q` `^O`) briefly and its menu appears, WordStar style.

## Sessions

Cursor position, bookmarks, block marks, the jump ring, and full undo history
persist per file (under the user data dir — your manuscript's folder stays
clean). Reopen a draft and your fingers are still in the pages.

## Config

`~/.config/perfectstar2k/config.toml`:

```toml
theme = "wp-blue"        # wp-blue | wordstar | terminal
menu_delay_ms = 700
autosave_secs = 60       # 0 disables
wrap = true
wrap_margin = 0          # 0 = window width
help_level = 1           # 0 clean · 1 delayed menus · 2 menus + hint bar
```

## Build

Rust 2024. `cargo build --release` produces the `pstar` binary.
`cargo test` runs the buffer/undo/wrap/markdown unit suites.