KILL_RING_TEST.md 3.3 KB

Kill Ring Testing Guide

Testing the Kill Ring Implementation

Open this file in lumacs to test the kill ring functionality:

./build/lumacs KILL_RING_TEST.md

Test Cases

Test 1: C-k (kill-line)

  1. Navigate to the line below
  2. Place cursor at the beginning of the line
  3. Press C-k to kill the line
  4. The text should be cut and added to kill ring

This is a test line for C-k functionality

Test 2: Kill to end of line

  1. Place cursor here: --> in the middle of this line
  2. Press C-k
  3. Everything after the cursor should be killed

Test 3: Kill newline at EOL

  1. Place cursor at the end of this line (after "line")
  2. Press C-k
  3. Should kill the newline and join with next line

Next line to be joined

Test 4: Mark and kill region (C-@ then C-w)

  1. Place cursor at START below
  2. Press C-@ (or C-SPC) to set mark
  3. Move to END
  4. Press C-w to kill region

START of region to kill. This entire block should be killed when you select it and press C-w. END of region.

Test 5: Copy region (M-w)

  1. Place cursor at START below
  2. Press C-@ to set mark
  3. Move to END
  4. Press M-w to copy (not cut)
  5. Text should stay but be in kill ring

START This text should be copied, not cut. END

Test 6: Yank (C-y)

  1. After killing or copying above, move cursor here:
  2. Press C-y to paste

Test 7: Yank-pop (M-y)

  1. Kill multiple different pieces of text (use C-k on different lines)
  2. Press C-y to yank the most recent
  3. Press M-y repeatedly to cycle through kill ring
  4. Each press of M-y replaces the yanked text with the previous kill ring entry

Line 1 for kill ring test Line 2 for kill ring test Line 3 for kill ring test

Test 8: Multiple kills accumulate

  1. Place cursor at the start of the paragraph below
  2. Press C-k multiple times in succession
  3. All killed lines should accumulate in one kill ring entry
  4. Paste with C-y - all lines should be pasted together

First killed line Second killed line Third killed line

Expected Behavior

  • C-@ (C-SPC): Sets mark, shows "Mark set" message
  • C-w: Kills (cuts) region between mark and cursor, message varies
  • M-w: Copies region to kill ring, shows "Region copied"
  • C-k: Kills from cursor to end of line
  • C-k at EOL: Kills the newline character (joins lines)
  • C-y: Pastes (yanks) from kill ring
  • M-y: After C-y, cycles through kill ring history

Debug Output

Check stderr for debug output like:

  • [DEBUG] Killed text: '...'
  • [DEBUG] Yanked: '...'
  • [DEBUG] Yank-pop: '...'

Success Criteria

✅ C-k kills to end of line ✅ C-k at EOL joins with next line ✅ C-@ sets mark ✅ C-w cuts marked region ✅ M-w copies marked region (doesn't delete) ✅ C-y pastes last killed text ✅ M-y after C-y cycles through kill history ✅ Mark is deactivated after kill/copy operation ✅ Multiple consecutive kills don't work yet (needs "last command" tracking)

Known Limitations

  1. Consecutive kills don't append yet (would need command history tracking)
  2. C-SPC might be sent as C-@ by terminal (this is correct Emacs behavior)
  3. No visual indication of active mark yet

Next Steps

After kill ring works, implement:

  • Phase 1.2: Mark and Region commands (C-x C-x, C-x h)
  • Phase 1.3: Word movement (M-f, M-b)
  • Phase 1.4: Page scrolling (C-v, M-v)