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

Method addNewLine

packages/pi-tui/src/components/editor.ts:1318–1341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1316 }
1317
1318 private addNewLine(): void {
1319 this.cancelAutocomplete();
1320 this.exitHistoryBrowsing();
1321 this.lastAction = null;
1322
1323 this.pushUndoSnapshot();
1324
1325 const currentLine = this.state.lines[this.state.cursorLine] || "";
1326
1327 const before = currentLine.slice(0, this.state.cursorCol);
1328 const after = currentLine.slice(this.state.cursorCol);
1329
1330 // Split current line
1331 this.state.lines[this.state.cursorLine] = before;
1332 this.state.lines.splice(this.state.cursorLine + 1, 0, after);
1333
1334 // Move cursor to start of new line
1335 this.state.cursorLine++;
1336 this.setCursorCol(0);
1337
1338 if (this.onChange) {
1339 this.onChange(this.getText());
1340 }
1341 }
1342
1343 private shouldSubmitOnBackslashEnter(data: string, kb: ReturnType<typeof getKeybindings>): boolean {
1344 if (this.disableSubmit) return false;

Callers 1

handleInputMethod · 0.95

Calls 5

cancelAutocompleteMethod · 0.95
exitHistoryBrowsingMethod · 0.95
pushUndoSnapshotMethod · 0.95
setCursorColMethod · 0.95
getTextMethod · 0.95

Tested by

no test coverage detected