skild 0.10.6 → 0.10.7
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/dist/index.js +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -263,15 +263,19 @@ async function interactiveTreeSelect(items, options) {
|
|
|
263
263
|
if (!stdin.isTTY || !stdout.isTTY) {
|
|
264
264
|
return defaultAll ? Array.from(selected) : null;
|
|
265
265
|
}
|
|
266
|
+
const useAltScreen = true;
|
|
266
267
|
const wasRaw = Boolean(stdin.isRaw);
|
|
267
268
|
stdin.setRawMode(true);
|
|
268
269
|
stdin.resume();
|
|
269
270
|
readline.emitKeypressEvents(stdin);
|
|
271
|
+
if (useAltScreen) {
|
|
272
|
+
stdout.write("\x1B[?1049h");
|
|
273
|
+
}
|
|
270
274
|
const renderer = createRenderer(title, subtitle, flatNodes, selected, () => cursor, formatNode);
|
|
271
275
|
writeToTerminal(stdout, renderer.renderContent());
|
|
272
276
|
return new Promise((resolve) => {
|
|
273
277
|
function cleanup(clear = false) {
|
|
274
|
-
if (clear) {
|
|
278
|
+
if (clear && !useAltScreen) {
|
|
275
279
|
const lineCount = renderer.getLineCount();
|
|
276
280
|
stdout.write(`\x1B[${lineCount}A`);
|
|
277
281
|
stdout.write("\x1B[0J");
|
|
@@ -280,6 +284,9 @@ async function interactiveTreeSelect(items, options) {
|
|
|
280
284
|
stdin.pause();
|
|
281
285
|
stdin.removeListener("keypress", onKeypress);
|
|
282
286
|
stdout.write("\x1B[?25h");
|
|
287
|
+
if (useAltScreen) {
|
|
288
|
+
stdout.write("\x1B[?1049l");
|
|
289
|
+
}
|
|
283
290
|
}
|
|
284
291
|
function rerender() {
|
|
285
292
|
clearAndRerender(stdout, renderer.getLineCount(), renderer.renderContent());
|