#curses #vt100 #terminal #tui

textmode

terminal interaction library backed by a real terminal parser

7 unstable releases

0.4.0 Mar 8, 2023
0.3.0 Dec 15, 2021
0.2.2 Dec 6, 2021
0.2.0 Nov 18, 2021
0.1.0 Mar 13, 2021

#183 in Command-line interface

Download history 6/week @ 2023-01-18 9/week @ 2023-01-25 12/week @ 2023-02-01 14/week @ 2023-02-08 21/week @ 2023-02-15 12/week @ 2023-02-22 2/week @ 2023-03-01 44/week @ 2023-03-08 11/week @ 2023-03-15 9/week @ 2023-03-22 6/week @ 2023-03-29 17/week @ 2023-04-05 22/week @ 2023-04-12 33/week @ 2023-04-19 10/week @ 2023-04-26 99/week @ 2023-05-03

164 downloads per month
Used in ttyrec-bin

MIT license

59KB
1K SLoC

textmode

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.

Dependencies

~1.7–8MB
~136K SLoC