MCPcopy
hub / github.com/bombshell-dev/clack / _shouldSubmit

Method _shouldSubmit

packages/core/src/prompts/multi-line.ts:64–87  ·  view source on GitHub ↗
(_char: string | undefined, _key: Key)

Source from the content-addressed store, hash-verified

62 }
63
64 protected override _shouldSubmit(_char: string | undefined, _key: Key): boolean {
65 if (this.#showSubmit) {
66 if (this.focused === 'submit') {
67 return true;
68 }
69 this.#insertAtCursor('\n');
70 this._cursor++;
71 return false;
72 }
73 const wasReturn = this.#lastKeyWasReturn;
74 this.#lastKeyWasReturn = true;
75 if (wasReturn && this.cursor === this.userInput.length) {
76 if (this.userInput[this.cursor - 1] === '\n') {
77 this._setUserInput(
78 this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)
79 );
80 this._cursor--;
81 }
82 return true;
83 }
84 this.#insertAtCursor('\n');
85 this._cursor++;
86 return false;
87 }
88
89 constructor(opts: MultiLineOptions) {
90 const initialUserInput = opts.initialUserInput ?? opts.initialValue;

Callers

nothing calls this directly

Calls 2

#insertAtCursorMethod · 0.95
_setUserInputMethod · 0.80

Tested by

no test coverage detected