(_char: string | undefined, _key: Key)
| 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; |
nothing calls this directly
no test coverage detected