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

Method addToHistory

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

* Add a prompt to history for up/down arrow navigation. * Called after successful submission.

(text: string)

Source from the content-addressed store, hash-verified

430 * Called after successful submission.
431 */
432 addToHistory(text: string): void {
433 const trimmed = text.trim();
434 if (!trimmed) return;
435 // Don't add consecutive duplicates
436 if (this.history.length > 0 && this.history[0] === trimmed) return;
437 this.history.unshift(trimmed);
438 // Limit history size
439 if (this.history.length > 100) {
440 this.history.pop();
441 }
442 }
443
444 private isEditorEmpty(): boolean {
445 return this.state.lines.length === 1 && this.state.lines[0] === "";

Callers

nothing calls this directly

Calls 1

popMethod · 0.80

Tested by

no test coverage detected