Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
termion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jonathan Schleußer
termion
Commits
e63b6458
Commit
e63b6458
authored
Sep 07, 2016
by
ticki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the documentation.
parent
5fa6289d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
13 deletions
+68
-13
Cargo.toml
Cargo.toml
+1
-1
README.md
README.md
+4
-4
examples/async.rs
examples/async.rs
+1
-1
src/async.rs
src/async.rs
+4
-2
src/color.rs
src/color.rs
+15
-1
src/cursor.rs
src/cursor.rs
+11
-1
src/input.rs
src/input.rs
+1
-1
src/raw.rs
src/raw.rs
+30
-1
src/style.rs
src/style.rs
+1
-1
No files found.
Cargo.toml
View file @
e63b6458
[package]
name
=
"termion"
version
=
"1.0.
7
"
version
=
"1.0.
8
"
authors
=
[
"ticki <Ticki@users.noreply.github.com>"
]
description
=
"A bindless library for manipulating terminals."
repository
=
"https://github.com/ticki/termion"
...
...
README.md
View file @
e63b6458
# Termion
Termion is a pure Rust, bindless library for low-level handling, manipulating
[
Documentation
](
https://docs.rs/termion
)
|
[
Examples
](
https://github.com/Ticki/termion/tree/master/examples
)
|
[
Changelog
](
https://github.com/Ticki/termion/tree/master/CHANGELOG.md
)
|----|----|----
**Termion**
is a pure Rust, bindless library for low-level handling, manipulating
and reading information about terminals. This provides a full-featured
alternative to Termbox.
...
...
@@ -18,9 +21,6 @@ cleaner to use escapes.
Supports Redox, Mac OS X, BSD, and Linux (or, in general, ANSI terminals).
[
Documentation
](
https://docs.rs/termion
)
|
[
Examples
](
https://github.com/Ticki/termion/tree/master/examples
)
|
[
Changelog
](
https://github.com/Ticki/termion/tree/master/CHANGELOG.md
)
|----|----|----
## A note on stability
Although small breaking changes might happen, I will try my best to avoid them,
...
...
examples/async.rs
View file @
e63b6458
...
...
@@ -2,7 +2,7 @@ extern crate termion;
use
termion
::
raw
::
IntoRawMode
;
use
termion
::
async_stdin
;
use
std
::
io
::{
Read
,
Write
,
stdout
,
stdin
};
use
std
::
io
::{
Read
,
Write
,
stdout
};
use
std
::
thread
;
use
std
::
time
::
Duration
;
...
...
src/async.rs
View file @
e63b6458
...
...
@@ -28,10 +28,12 @@ pub fn async_stdin() -> AsyncReader {
}
/// An asynchronous reader.
///
/// This acts as any other stream, with the exception that reading from it won't block. Instead,
/// the buffer will only be partially updated based on how much the internal buffer holds.
pub
struct
AsyncReader
{
/// The underlying mpsc receiver.
#[doc(hidden)]
pub
recv
:
mpsc
::
Receiver
<
io
::
Result
<
u8
>>
,
recv
:
mpsc
::
Receiver
<
io
::
Result
<
u8
>>
,
}
impl
Read
for
AsyncReader
{
...
...
src/color.rs
View file @
e63b6458
//! Colors.
//! Color managemement.
//!
//! # Example
//!
//! ```rust
//! use termion::{color, style};
//!
//! use std::io;
//!
//! fn main() {
//! println!("{}Red", color::Fg(color::Red));
//! println!("{}Blue", color::Fg(color::Blue));
//! println!("{}Back again", color::Fg(color::Reset));
//! }
//! ```
use
std
::
fmt
;
...
...
src/cursor.rs
View file @
e63b6458
//! Cursor.
//! Cursor
movement
.
use
std
::
fmt
;
...
...
@@ -12,6 +12,16 @@ derive_csi_sequence!("Show the cursor.", Show, "?25h");
/// ANSI escapes are very poorly designed, and one of the many odd aspects is being one-based. This
/// can be quite strange at first, but it is not that big of an obstruction once you get used to
/// it.
///
/// # Example
///
/// ```rust
/// extern crate termion;
///
/// fn main() {
/// print!("{}{}Stuff", termion::clear::All, termion::cursor::Goto(5, 3));
/// }
/// ```
#[derive(Copy,
Clone,
PartialEq,
Eq)]
pub
struct
Goto
(
pub
u16
,
pub
u16
);
...
...
src/input.rs
View file @
e63b6458
//!
I
nput.
//!
User i
nput.
use
std
::
io
::{
self
,
Read
,
Write
};
use
std
::
ops
;
...
...
src/raw.rs
View file @
e63b6458
//! Raw mode.
//! Managing raw mode.
//!
//! Raw mode is a particular state a TTY can have. It signifies that:
//!
//! 1. No line buffering (the input is given byte-by-byte).
//! 2. The input is not written out, instead it has to be done manually by the programmer.
//! 3. The output is not canonicalized (for example, `\n` means "go one line down", not "line
//! break").
//!
//! It is essential to design terminal programs.
//!
//! # Example
//!
//! ```rust,ignore
//! use termion::raw::IntoRawMode;
//! use std::io::{Write, stdout};
//!
//! fn main() {
//! let mut stdout = stdout().into_raw_mode().unwrap();
//!
//! write!(stdout, "Hey there.").unwrap();
//! }
//! ```
use
std
::
io
::{
self
,
Write
};
use
std
::
ops
;
/// A terminal restorer, which keeps the previous state of the terminal, and restores it, when
/// dropped.
///
/// Restoring will entirely bring back the old TTY state.
#[cfg(target_os
=
"redox"
)]
pub
struct
RawTerminal
<
W
:
Write
>
{
output
:
W
,
...
...
@@ -60,6 +84,11 @@ impl<W: Write> Write for RawTerminal<W> {
}
/// Types which can be converted into "raw mode".
///
/// # Why is this type defined on writers and not readers?
///
/// TTYs has their state controlled by the writer, not the reader. You use the writer to clear the
/// screen, move the cursor and so on, so naturally you use the writer to change the mode as well.
pub
trait
IntoRawMode
:
Write
+
Sized
{
/// Switch to raw mode.
///
...
...
src/style.rs
View file @
e63b6458
//!
Style
.
//!
Text styling management
.
use
std
::
fmt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment