Skip to content

[v0.3] Replace cut slot with a real kill ring #47

Description

@owainlewis

Goal: Replace the current single cut/yank slot with a small Emacs-shaped kill ring.

Context: Cortex already has mark, region cut, C-k, and C-y in the local editor surface.
The PRD calls for a real ring with yank-pop behavior.
This is core editing feel, not a broad feature expansion.

Proposed approach:

  • Store killed text in a bounded ring instead of one optional string.
  • Push region kills and line kills onto the ring.
  • Keep C-y yanking the most recent entry.
  • Add yank-pop with M-y only immediately after a yank.
  • Keep behavior simple when there is no prior yank: show a status message and leave the buffer unchanged.
  • Preserve dirty state and point behavior across kill, yank, undo, and redo.

Acceptance criteria:

  • Multiple kills are retained in newest-first ring order.
  • C-y inserts the newest kill at point.
  • M-y after C-y replaces the just-yanked text with the previous ring entry.
  • M-y without a preceding yank reports a clear no-op status.
  • Undo cleanly reverses kill, yank, and yank-pop edits.
  • Region state is cleared after edits that should clear it.
  • Existing kill line, kill region, save, search, picker, and quit behavior still works.

Verification:

  • Run cargo test.
  • Manually kill two different chunks, yank, yank-pop, undo, redo, save, and quit.
  • Manually confirm terminal cleanup after exit.

Out of scope:

  • System clipboard integration.
  • Persistent kill history.
  • Emacs-compatible kill coalescing across every edge case.
  • Visual kill ring browser.

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 requestfactory-readyClear, focused, unblocked work an agent may implementgood first issueGood for newcomersquick winSmall, self-contained task

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions