agentskillsdk 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/prompt.js +8 -8
package/package.json
CHANGED
package/src/lib/prompt.js
CHANGED
|
@@ -77,10 +77,10 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
77
77
|
|
|
78
78
|
// Enter
|
|
79
79
|
if (key === '\r' || key === '\n') {
|
|
80
|
-
// Move
|
|
81
|
-
const upCount = totalPhysicalLines(prevLines);
|
|
82
|
-
stdout.write(`\x1b[${upCount}A`);
|
|
83
|
-
stdout.write('\x1b[J'); // clear to end
|
|
80
|
+
// Move cursor to start of first choice line, then clear
|
|
81
|
+
const upCount = totalPhysicalLines(prevLines) - 1;
|
|
82
|
+
if (upCount > 0) stdout.write(`\x1b[${upCount}A`);
|
|
83
|
+
stdout.write('\r\x1b[J'); // col 0, clear to end
|
|
84
84
|
const final = ` ${chalk.cyan('\u276f')} ${chalk.cyan(choices[selected].label)}`;
|
|
85
85
|
stdout.write(final + '\n');
|
|
86
86
|
cleanup();
|
|
@@ -99,10 +99,10 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
99
99
|
return; // ignore other keys
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// Redraw: move cursor
|
|
103
|
-
const upCount = totalPhysicalLines(prevLines);
|
|
104
|
-
stdout.write(`\x1b[${upCount}A`);
|
|
105
|
-
stdout.write('\x1b[J');
|
|
102
|
+
// Redraw: move cursor to start of first choice line, clear, rewrite
|
|
103
|
+
const upCount = totalPhysicalLines(prevLines) - 1;
|
|
104
|
+
if (upCount > 0) stdout.write(`\x1b[${upCount}A`);
|
|
105
|
+
stdout.write('\r\x1b[J');
|
|
106
106
|
prevLines = render();
|
|
107
107
|
stdout.write(prevLines.join('\n'));
|
|
108
108
|
}
|