MCPcopy
hub / github.com/bombshell-dev/clack / #handleCursor

Method #handleCursor

packages/core/src/prompts/multi-line.ts:46–62  ·  view source on GitHub ↗
(key?: CursorAction)

Source from the content-addressed store, hash-verified

44 );
45 }
46 #handleCursor(key?: CursorAction) {
47 const text = this.value ?? '';
48 switch (key) {
49 case 'up':
50 this._cursor = findTextCursor(this._cursor, 0, -1, text);
51 return;
52 case 'down':
53 this._cursor = findTextCursor(this._cursor, 0, 1, text);
54 return;
55 case 'left':
56 this._cursor = findTextCursor(this._cursor, -1, 0, text);
57 return;
58 case 'right':
59 this._cursor = findTextCursor(this._cursor, 1, 0, text);
60 return;
61 }
62 }
63
64 protected override _shouldSubmit(_char: string | undefined, _key: Key): boolean {
65 if (this.#showSubmit) {

Callers 1

constructorMethod · 0.95

Calls 1

findTextCursorFunction · 0.85

Tested by

no test coverage detected