@shnitzel/plugscout 0.3.12 → 0.3.13
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.
|
@@ -192,24 +192,27 @@ export async function renderInteractiveHome() {
|
|
|
192
192
|
const CTRL_C = '\u0003';
|
|
193
193
|
function render(firstRender) {
|
|
194
194
|
if (!firstRender) {
|
|
195
|
-
|
|
195
|
+
// Restore saved cursor position and clear everything below it.
|
|
196
|
+
// This avoids line-count arithmetic that breaks when descriptions wrap.
|
|
197
|
+
process.stdout.write('\x1b[u\x1b[0J');
|
|
196
198
|
}
|
|
197
199
|
for (let i = 0; i < menuItems.length; i++) {
|
|
198
200
|
const item = menuItems[i];
|
|
199
201
|
const prefix = i === selected ? ' \u276f ' : ' ';
|
|
200
|
-
process.stdout.write(
|
|
202
|
+
process.stdout.write(`${prefix}${item.label}\n`);
|
|
201
203
|
if (item.description) {
|
|
202
204
|
const firstLine = item.description.split('\n')[0];
|
|
203
|
-
process.stdout.write(
|
|
205
|
+
process.stdout.write(` \x1b[2m${firstLine}\x1b[0m\n`);
|
|
204
206
|
}
|
|
205
207
|
else {
|
|
206
|
-
process.stdout.write(
|
|
208
|
+
process.stdout.write('\n');
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
let running = true;
|
|
211
213
|
while (running) {
|
|
212
214
|
process.stdout.write('\n');
|
|
215
|
+
process.stdout.write('\x1b[s'); // save cursor — used by render(false) to redraw in-place
|
|
213
216
|
process.stdin.setRawMode(true);
|
|
214
217
|
process.stdin.resume();
|
|
215
218
|
process.stdin.setEncoding('utf8');
|
package/package.json
CHANGED