Intro
term_cursor
is a crate for handling terminal cursor movement in a platform independent way.
The supported platforms are:
Windows
Linux
OS X
(not tested)FreeBSD
(not tested)OpenBSD
(not tested)
API
This crate provides 2 APIs which can be used to achieve the same effects:
- A functions based approach, which provides very simple functions to directly interact with the terminal (see the functions section below).
- A newtype pattern based approach, that provies a bunch of types which all implement
std::fmt::Display
(see the structs section below). When such types get formatted, they operate on the terminal in a way very similar to the functions API.
Watch out!
Both APIs always operate on the "default" terminal that is bound to the process.
In other words, on Windows GetStdHandle(STD_OUTPUT_HANDLE)
is used, and on *NIX, the ANSI terminal communcation is done through stdout
/ stdin
.