@inquirer/core 11.1.8 → 11.1.10

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.
@@ -12,7 +12,7 @@ import path from 'node:path';
12
12
  const nativeSetImmediate = globalThis.setImmediate;
13
13
  function getCallSites() {
14
14
  // oxlint-disable-next-line typescript/unbound-method
15
- const _prepareStackTrace = Error.prepareStackTrace;
15
+ const savedPrepareStackTrace = Error.prepareStackTrace;
16
16
  let result = [];
17
17
  try {
18
18
  Error.prepareStackTrace = (_, callSites) => {
@@ -28,7 +28,7 @@ function getCallSites() {
28
28
  // https://nodejs.org/api/cli.html#--frozen-intrinsics
29
29
  return result;
30
30
  }
31
- Error.prepareStackTrace = _prepareStackTrace;
31
+ Error.prepareStackTrace = savedPrepareStackTrace;
32
32
  return result;
33
33
  }
34
34
  export function createPrompt(view) {
@@ -40,16 +40,17 @@ export function createPrompt(view) {
40
40
  // Add mute capabilities to the output
41
41
  const output = new MuteStream();
42
42
  output.pipe(context.output ?? process.stdout);
43
- // Pre-mute the output so that readline doesn't echo stale keystrokes
44
- // to the terminal before the first render. ScreenManager will unmute/mute
45
- // the output around each render call as needed.
46
- output.mute();
47
43
  // oxlint-disable-next-line typescript/no-unsafe-type-assertion
48
44
  const rl = readline.createInterface({
49
45
  terminal: true,
50
46
  input,
51
47
  output,
52
48
  });
49
+ // Mute the output after readline has initialized so readline can perform
50
+ // any terminal setup writes (e.g. Windows Console API initialization)
51
+ // before suppressing output. ScreenManager will unmute/mute around each
52
+ // render call as needed.
53
+ output.mute();
53
54
  const screen = new ScreenManager(rl);
54
55
  const { promise, resolve, reject } = PromisePolyfill.withResolver();
55
56
  const cancel = () => reject(new CancelPromptError());
@@ -1,6 +1,6 @@
1
1
  import { stripVTControlCharacters } from 'node:util';
2
2
  import { breakLines, readlineWidth } from "./utils.js";
3
- import { cursorDown, cursorUp, cursorTo, cursorShow, eraseLines } from '@inquirer/ansi';
3
+ import { cursorDown, cursorLeft, cursorUp, cursorTo, cursorShow, eraseLines, } from '@inquirer/ansi';
4
4
  const height = (content) => content.split('\n').length;
5
5
  const lastLine = (content) => content.split('\n').pop() ?? '';
6
6
  export default class ScreenManager {
@@ -72,6 +72,11 @@ export default class ScreenManager {
72
72
  this.rl.setPrompt('');
73
73
  let output = cursorDown(this.extraLinesUnderPrompt);
74
74
  output += clearContent ? eraseLines(this.height) : '\n';
75
+ // Reset cursor to column 0. On Windows terminals, \n moves the cursor
76
+ // down without resetting the column when the rendered prompt+answer
77
+ // wraps past the terminal width. Without this, all subsequent output
78
+ // starts at the wrong horizontal offset.
79
+ output += cursorLeft;
75
80
  output += cursorShow;
76
81
  this.write(output);
77
82
  this.rl.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/core",
3
- "version": "11.1.8",
3
+ "version": "11.1.10",
4
4
  "description": "Core Inquirer prompt API",
5
5
  "keywords": [
6
6
  "answer",
@@ -93,5 +93,5 @@
93
93
  },
94
94
  "main": "./dist/index.js",
95
95
  "types": "./dist/index.d.ts",
96
- "gitHead": "e68fe01d65359e083581c48c4a18cd8f97d88842"
96
+ "gitHead": "113558c67f0d781d774cf3cf4db48fbcd8738b13"
97
97
  }