jal3/termBuffer/escapeSequences.nim

14 lines
310 B
Nim

# list of functions to generate escape sequences
import strformat
import strutils
func escCursorPos*(x, y: int): string =
&"\e[{y+1};{x+1}H"
func escAttributes*(attributes: seq[uint8]): string =
let joined = attributes.join(";")
&"\e[{joined}m"
func escEraseCharacters*(n: int): string =
&"\e[{n}X"