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

Method setTextInternal

packages/pi-tui/src/components/editor.ts:533–544  ·  view source on GitHub ↗

Internal setText that doesn't reset history state - used by navigateHistory

(text: string, cursorPlacement: "start" | "end" = "end")

Source from the content-addressed store, hash-verified

531
532 /** Internal setText that doesn't reset history state - used by navigateHistory */
533 private setTextInternal(text: string, cursorPlacement: "start" | "end" = "end"): void {
534 const lines = text.split("\n");
535 this.state.lines = lines.length === 0 ? [""] : lines;
536 this.state.cursorLine = cursorPlacement === "start" ? 0 : this.state.lines.length - 1;
537 this.setCursorCol(cursorPlacement === "start" ? 0 : this.state.lines[this.state.cursorLine]?.length || 0);
538 // Reset scroll - render() will adjust to show cursor
539 this.scrollOffset = 0;
540
541 if (this.onChange) {
542 this.onChange(this.getText());
543 }
544 }
545
546 invalidate(): void {
547 // No cached state to invalidate currently

Callers 2

navigateHistoryMethod · 0.95
setTextMethod · 0.95

Calls 2

setCursorColMethod · 0.95
getTextMethod · 0.95

Tested by

no test coverage detected