insertSpace

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

function ยท experimental

function insertSpace(x: number = 1): string

Inserts x spaces at the cursor position. Shifting existing line content to the right. Cursor position does not change. Characters that exit the display are discarded.

x: number = 1

The number of spaces to insert.

Returns

The ANSI escape code for inserting spaces.

Example: Usage

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

console.log("Hello World!");
await delay(1000);
console.log(
  Ansi.moveCursorUp() +
    Ansi.setCursorColumn(6) +
    Ansi.insertSpace(10),
);

Source