cursor

package module
v0.0.0-...-8136607 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2013 License: Apache-2.0 Imports: 1 Imported by: 9

README

go-cursor

Provides ANSI escape sequences (strings) for manipulating cursor on terminals.

Usage

Here is equivalent of clear program (cls command on Windows) written in Go using go-cursor:

package main

import (
    "fmt"
    "github.com/ahmetalpbalkan/go-cursor"
)

func main() {
    fmt.Print(cursor.ClearEntireScreen())
    fmt.Print(cursor.MoveTo(0, 0))
}

Documentation

Overview

Package cursor provides ANSI Escape sequences introduced in VT-100 terminals for cursor and screen manipulation operations.

Index

Constants

This section is empty.

Variables

View Source
var Esc = "\x1b"

Functions

func ClearEntireLine

func ClearEntireLine() string

ClearEntireLine returns ANSI escape sequence to clear current line.

func ClearEntireScreen

func ClearEntireScreen() string

ClearEntireScreen returns ANSI escape sequence to clear the screen.

func ClearLineLeft

func ClearLineLeft() string

ClearLineLeft returns ANSI escape sequence to clear line from left of the cursor.

func ClearLineRight

func ClearLineRight() string

ClearLineRight returns ANSI escape sequence to clear line from right of the cursor.

func ClearScreenDown

func ClearScreenDown() string

ClearScreenDown returns ANSI escape sequence to clear screen below. the cursor.

func ClearScreenUp

func ClearScreenUp() string

ClearScreenUp returns ANSI escape sequence to clear screen above. the cursor.

func Hide

func Hide() string

Hide returns ANSI escape sequence to hide the cursor

func MoveDown

func MoveDown(n int) string

MoveDown returns ANSI escape sequence to move cursor down n lines.

func MoveLeft

func MoveLeft(n int) string

MoveLeft returns ANSI escape sequence to move cursor left n columns.

func MoveNextLine

func MoveNextLine() string

MoveNextLine returns ANSI escape sequence to move cursor to next line.

func MoveRight

func MoveRight(n int) string

MoveRight returns ANSI escape sequence to move cursor right n columns.

func MoveTo

func MoveTo(line, col int) string

MoveTo returns ANSI escape sequence to move cursor to specified position on screen.

func MoveUp

func MoveUp(n int) string

MoveUp returns ANSI escape sequence to move cursor up n lines.

func MoveUpperLeft

func MoveUpperLeft(n int) string

MoveUpperLeft returns ANSI escape sequence to move cursor to upper left corner of screen.

func RestoreAttributes

func RestoreAttributes() string

RestoreAttributes returns ANSI escape sequence to restore saved position and attributes of the cursor.

func SaveAttributes

func SaveAttributes() string

SaveAttributes returns ANSI escape sequence to save current position and attributes of the cursor.

func Show

func Show() string

Show returns ANSI escape sequence to show the cursor

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL