Skip to content

Group ordinary typing and deletion into useful undo steps #166

Description

@owainlewis

Group ordinary typing and deletion into useful undo steps

What are we building?

Every typed character is currently a separate undo step. Group contiguous typing and deletion while keeping intentional commands separate and preserving save/reload history.

Why?

This removes a concrete obstacle to the local coding loop tracked in #160 while keeping Cortex small and predictable.

Done when

  • Contiguous ordinary typing is reversed by one undo, and contiguous backward/forward deletion groups by direction.

  • Movement, prompts, buffer switches, save, newline, paste, indentation, kill/yank, and undo/redo end the current typing group.

  • A pause of at least 750 ms ends a typing group; tests use an injected clock or explicit timestamps.

  • Undo restores the original point; redo restores the complete group; new editing after undo discards only the redo branch.

  • Saved-state and changed-line markers remain correct across groups, save, undo, redo, and Unicode edits.

  • Retained undo/redo text payload is limited to 16 MiB per buffer by evicting oldest whole groups; preserve the newest group even when it alone exceeds the budget, and keep dirty-baseline identity correct after eviction.

How to check

cargo test buffer::; cargo test app::; cargo test commands::; cargo fmt --check; cargo clippy --all-targets -- -D warnings; cargo test. Type a word, move, type another, undo/redo each step, save, and exit.

Agent notes

  • Depends on: Indentation and terminal paste.
  • Source: Deliver a minimalist daily coding editor #160 and the product direction in docs/prd.md. Keep macOS-only behavior, Ropey storage, view-owned point/scroll, and the renderer boundary. Preserve dirty-buffer, atomic-save, disk-change, and grapheme-boundary guarantees.
  • Keep a linear history. Do not merge edits across a clean save boundary or replace precise structural edit metadata with whole-file snapshots.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions