moveCursorUp

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

function ยท experimental

function moveCursorUp(x: number = 1): string

Moves cursor position up x lines or up to the top margin.

x: number = 1

The number of lines to move up.

Returns

The ANSI escape code for moving the cursor up.

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.moveCursorUp(2) + "Goodbye");

Source