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

Method handleBackspace

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

Source from the content-addressed store, hash-verified

222 }
223
224 private handleBackspace(): void {
225 this.lastAction = null;
226 if (this.cursor > 0) {
227 this.pushUndo();
228 const beforeCursor = this.value.slice(0, this.cursor);
229 const graphemes = [...segmenter.segment(beforeCursor)];
230 const lastGrapheme = graphemes[graphemes.length - 1];
231 const graphemeLength = lastGrapheme ? lastGrapheme.segment.length : 1;
232 this.value = this.value.slice(0, this.cursor - graphemeLength) + this.value.slice(this.cursor);
233 this.cursor -= graphemeLength;
234 }
235 }
236
237 private handleForwardDelete(): void {
238 this.lastAction = null;

Callers 1

handleInputMethod · 0.95

Calls 2

pushUndoMethod · 0.95
segmentMethod · 0.45

Tested by

no test coverage detected