MCPcopy Index your code
hub / github.com/nodejs/node / cursorTo

Method cursorTo

lib/internal/readline/promises.js:44–53  ·  view source on GitHub ↗

* Moves the cursor to the x and y coordinate on the given stream. * @param {integer} x * @param {integer} [y] * @returns {Readline} this

(x, y = undefined)

Source from the content-addressed store, hash-verified

42 * @returns {Readline} this
43 */
44 cursorTo(x, y = undefined) {
45 validateInteger(x, 'x');
46 if (y != null) validateInteger(y, 'y');
47
48 const data = y == null ? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`;
49 if (this.#autoCommit) process.nextTick(() => this.#stream.write(data));
50 else ArrayPrototypePush(this.#todo, data);
51
52 return this;
53 }
54
55 /**
56 * Moves the cursor relative to its current location.

Callers 7

tty.jsFile · 0.80
clearLineMethod · 0.80
updateProgressMethod · 0.80
#clearSpinnerMethod · 0.80

Calls 2

CSIFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected