MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / pushToKillRing

Function pushToKillRing

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

Source from the content-addressed store, hash-verified

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

Callers 4

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

Calls

no outgoing calls

Tested by

no test coverage detected