MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / deleteWordForward

Method deleteWordForward

packages/pi-tui/src/components/input.ts:289–307  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287 }
288
289 private deleteWordForward(): void {
290 if (this.cursor >= this.value.length) return;
291
292 // Save lastAction before cursor movement (moveWordForwards resets it)
293 const wasKill = this.lastAction === "kill";
294
295 this.pushUndo();
296
297 const oldCursor = this.cursor;
298 this.moveWordForwards();
299 const deleteTo = this.cursor;
300 this.cursor = oldCursor;
301
302 const deletedText = this.value.slice(this.cursor, deleteTo);
303 this.killRing.push(deletedText, { prepend: false, accumulate: wasKill });
304 this.lastAction = "kill";
305
306 this.value = this.value.slice(0, this.cursor) + this.value.slice(deleteTo);
307 }
308
309 private yank(): void {
310 const text = this.killRing.peek();

Callers 1

handleInputMethod · 0.95

Calls 3

pushUndoMethod · 0.95
moveWordForwardsMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected