Skip to content

clipboard: lift Cut/Copy/Paste from ted into the Editor (Command.Cut/Copy/Paste + key bindings) #101

@tig

Description

@tig

Today Cut, Copy, and Paste live in examples/ted/TedApp.EditCommands.cs. Per specs/clipboard/spec.md the Editor should own these as first-class commands so any consumer (clet, etc.) gets them for free.

Scope

  • Add Command.Cut, Command.Copy, Command.Paste handlers in Editor.Commands.cs.
  • Default keybindings on the Editor keymap: Ctrl+X / Ctrl+C / Ctrl+V (do not hard-code — register through Terminal.Gui's command key dictionary).
  • Cut and Paste run inside a single Document.OpenUpdateScope () → one undo step.
  • Multi-line paste preserves embedded line endings.
  • ReadOnly blocks Cut/Paste; Copy still allowed.
  • Resolve the [NEEDS CLARIFICATION] in FR-005: when there is no selection, default to no-op for Cut/Copy (matches VS Code's most-common preset). Document the decision in specs/decisions.md.
  • Remove the now-redundant private Cut/Copy/Paste methods from TedApp.EditCommands.cs; the menu items already bind via Command.Cut/Copy/Paste, so they should pick up the Editor command automatically.

Definition of Done

  • Round-trip tests: copy → paste across selection and caret cases.
  • Multi-line paste test (LF + CRLF).
  • Cut emits exactly one undo step (single Ctrl+Z restores text + selection).
  • ReadOnly blocks Cut and Paste; Copy still works.
  • Ted's Edit menu still works — the private wrappers are gone but the menu items invoke the Editor command.
  • Decision logged in specs/decisions.md for the no-selection behavior.

Spec

specs/clipboard/spec.md

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions