Crates.io | textmode |
lib.rs | textmode |
version | 0.4.0 |
source | src |
created_at | 2021-03-13 22:16:56.875614 |
updated_at | 2023-03-08 18:24:27.354227 |
description | terminal interaction library backed by a real terminal parser |
homepage | |
repository | https://git.tozt.net/textmode |
max_upload_size | |
id | 368519 |
size | 85,621 |
textmode
is a library for terminal interaction built on top of a real
terminal parsing library. It allows you to do arbitrary drawing operations on
an in-memory screen, and then update the visible terminal output to reflect the
in-memory screen via an optimized diff algorithm when you are finished. Being
built on a real terminal parsing library means that while normal curses-like
operations are available:
use textmode::Textmode;
let mut tm = textmode::Output::new().await?;
tm.clear();
tm.move_to(5, 5);
tm.set_fgcolor(textmode::color::RED);
tm.write_str("foo");
tm.refresh().await?;
you can also write data containing arbitrary terminal escape codes to the output and they will also do the right thing:
tm.write(b"\x1b[34m\x1b[3;9Hbar\x1b[m");
tm.refresh().await?;
This module is split into two main parts: Output
and Input
. See the
documentation for those types for more details. Additionally, the blocking
module provides an equivalent interface with blocking calls instead of async.