MCPcopy
hub / github.com/codeaashu/claude-code / pushToKillRing

Function pushToKillRing

src/utils/Cursor.ts:26–49  ·  view source on GitHub ↗
(
  text: string,
  direction: 'prepend' | 'append' = 'append',
)

Source from the content-addressed store, hash-verified

24let lastActionWasYank = false
25
26export function pushToKillRing(
27 text: string,
28 direction: 'prepend' | 'append' = 'append',
29): void {
30 if (text.length > 0) {
31 if (lastActionWasKill && killRing.length > 0) {
32 // Accumulate with the most recent kill
33 if (direction === 'prepend') {
34 killRing[0] = text + killRing[0]
35 } else {
36 killRing[0] = killRing[0] + text
37 }
38 } else {
39 // Add new entry to front of ring
40 killRing.unshift(text)
41 if (killRing.length > KILL_RING_MAX_SIZE) {
42 killRing.pop()
43 }
44 }
45 lastActionWasKill = true
46 // Reset yank state when killing new text
47 lastActionWasYank = false
48 }
49}
50
51export function getLastKill(): string {
52 return killRing[0] ?? ''

Callers 4

handleKeyDownFunction · 0.85
killToLineEndFunction · 0.85
killToLineStartFunction · 0.85
killWordBeforeFunction · 0.85

Calls 1

popMethod · 0.80

Tested by

no test coverage detected