Skip to content

Commit

Permalink
fix: compat layer for ansi 0.3->0.4 migration (#225)
Browse files Browse the repository at this point in the history
* fix: compat layer for ansi 0.3->0.4 migration

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* Update ansi/cursor.go

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
  • Loading branch information
caarlos0 and aymanbagabas authored Oct 29, 2024
1 parent 1032e03 commit 8315017
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ansi/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down

0 comments on commit 8315017

Please sign in to comment.