insertLines

import { insertLines } from "jsr:@ende/cli/unstable-ansi";

function ยท experimental

function insertLines(x: number = 1): string

Inserts x lines at cursor position. Shifting current line and below down. Cursor position does not change. Characters that exit the display are discarded.

x: number = 1

The number of lines to insert.

Returns

The ANSI escape code for inserting lines.

Example: Usage

import { delay } from "@ende/async/delay";
import * as Ansi from "@ende/cli/unstable-ansi";

console.log("Hello\nWorld!");
await delay(1000);
console.log(
  Ansi.moveCursorUpStart() +
    Ansi.insertLines() +
    "and Goodbye",
);

Source