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

Method deleteWordBackwards

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

Source from the content-addressed store, hash-verified

266 }
267
268 private deleteWordBackwards(): void {
269 if (this.cursor === 0) return;
270
271 // Save lastAction before cursor movement (moveWordBackwards resets it)
272 const wasKill = this.lastAction === "kill";
273
274 this.pushUndo();
275
276 const oldCursor = this.cursor;
277 this.moveWordBackwards();
278 const deleteFrom = this.cursor;
279 this.cursor = oldCursor;
280
281 const deletedText = this.value.slice(deleteFrom, this.cursor);
282 this.killRing.push(deletedText, { prepend: true, accumulate: wasKill });
283 this.lastAction = "kill";
284
285 this.value = this.value.slice(0, deleteFrom) + this.value.slice(this.cursor);
286 this.cursor = deleteFrom;
287 }
288
289 private deleteWordForward(): void {
290 if (this.cursor >= this.value.length) return;

Callers 1

handleInputMethod · 0.95

Calls 3

pushUndoMethod · 0.95
moveWordBackwardsMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected