From 8315017daad4e34df3dd1a0394ea09bd3d1681e1 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 29 Oct 2024 11:00:37 -0300 Subject: [PATCH] fix: compat layer for ansi 0.3->0.4 migration (#225) * fix: compat layer for ansi 0.3->0.4 migration Signed-off-by: Carlos Alexandro Becker * Update ansi/cursor.go --------- Signed-off-by: Carlos Alexandro Becker Co-authored-by: Ayman Bagabas --- ansi/cursor.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ansi/cursor.go b/ansi/cursor.go index f79e1e7e..8a917b2d 100644 --- a/ansi/cursor.go +++ b/ansi/cursor.go @@ -163,10 +163,28 @@ func SetCursorPosition(col, row int) string { return "\x1b[" + strconv.Itoa(row) + ";" + strconv.Itoa(col) + "H" } +// MoveCursor (CUP) returns a sequence for setting the cursor to the +// given row and column. +// +// CSI n ; m H +// +// See: https://vt100.net/docs/vt510-rm/CUP.html +// +// Deprecated: use SetCursorPosition instead. +func MoveCursor(col, row int) string { + return SetCursorPosition(col, row) +} + // CursorOrigin is a sequence for moving the cursor to the upper left corner of // the display. This is equivalent to `SetCursorPosition(1, 1)`. const CursorOrigin = "\x1b[1;1H" +// MoveCursorOrigin is a sequence for moving the cursor to the upper left +// corner of the display. This is equivalent to `SetCursorPosition(1, 1)`. +// +// Deprecated: use CursorOrigin instead. +const MoveCursorOrigin = CursorOrigin + // SaveCursorPosition (SCP or SCOSC) is a sequence for saving the cursor // position. //