@jsvision/core / cursor
Variable: cursor
constcursor:object
Defined in: render/cursor.ts:18
Capability-independent cursor controls (show/hide/absolute move). Each method returns an ANSI string for you to write to the terminal.
Type Declaration
hide()
readonlyhide():string
Hide the text cursor (CSI ?25 l).
Returns
string
show()
readonlyshow():string
Show the text cursor (CSI ?25 h).
Returns
string
to()
readonlyto(row,col):string
Move the cursor to a 1-based (row, col) (CSI row;col H).
Parameters
row
number
1-based row (top is 1).
col
number
1-based column (left is 1).
Returns
string
Example
ts
import { cursor } from '@jsvision/core';
process.stdout.write(cursor.hide()); // hide during a repaint
process.stdout.write(cursor.to(5, 10)); // move to row 5, column 10 (1-based)
process.stdout.write(cursor.show()); // show it again