MCPcopy Create free account
hub / github.com/bombshell-dev/clack / userInputWithCursor

Method userInputWithCursor

packages/core/src/prompts/text.ts:10–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9export default class TextPrompt extends Prompt<string> {
10 get userInputWithCursor() {
11 if (this.state === 'submit') {
12 return this.userInput;
13 }
14 const userInput = this.userInput;
15 if (this.cursor >= userInput.length) {
16 return `${this.userInput}█`;
17 }
18 const s1 = userInput.slice(0, this.cursor);
19 const [s2, ...s3] = userInput.slice(this.cursor);
20 return `${s1}${styleText('inverse', s2)}${s3.join('')}`;
21 }
22 get cursor() {
23 return this._cursor;
24 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected