updated doc
This commit is contained in:
parent
26060a56eb
commit
410009dc46
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "crossterm"
|
||||
version = "0.4.0"
|
||||
authors = ["T Post <timonpost@hotmail.nl>"]
|
||||
authors = ["T. Post"]
|
||||
description = "An crossplatform terminal library for manipulating terminals."
|
||||
repository = "https://github.com/TimonPost/crossterm"
|
||||
documentation = "https://docs.rs/crossterm/"
|
||||
|
38
README.md
38
README.md
@ -1,6 +1,6 @@
|
||||
# Crossterm | cross-platform terminal manipulating library written in rust.
|
||||
|
||||
[![Latest Version](https://img.shields.io/crates/v/crossterm.svg)](https://crates.io/crates/crossterm) | [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) | [![docs.rs](https://docs.rs/crossterm/badge.svg)](https://docs.rs/crossterm/) | [Examples](https://github.com/TimonPost/crossterm/tree/master/examples) | [Changelog](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) | [Release Nodes](https://github.com/TimonPost/crossterm/tree/master/docs)
|
||||
[![Latest Version](https://img.shields.io/crates/v/crossterm.svg)](https://crates.io/crates/crossterm) | [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) | [![docs.rs](https://docs.rs/crossterm/badge.svg)](https://docs.rs/crossterm/) | [Examples](https://github.com/TimonPost/crossterm/tree/master/examples) | [Changelog](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) | [Release Nodes](https://github.com/TimonPost/crossterm/blob/master/docs/ReleaseNotes.md)
|
||||
|----|----|----|----|----|----
|
||||
|
||||
Ever got disappointed when a terminal library for rust was only written for unix systems?
|
||||
@ -17,9 +17,10 @@ This crate supports all unix and windows terminals down to windows 7 (not all te
|
||||
- [Useful links](https://github.com/TimonPost/crossterm#useful-links)
|
||||
- [Features](https://github.com/TimonPost/crossterm#features)
|
||||
- [Examples](https://github.com/TimonPost/crossterm#examples)
|
||||
- [Crossterm Wrapper](https://github.com/TimonPost/crossterm#crossterm-wrapper--see-more)
|
||||
- [Styling](https://github.com/TimonPost/crossterm#styled-font--see-more)
|
||||
- [Crossterm Wrapper](https://github.com/TimonPost/crossterm#crossterm-type--see-more)
|
||||
- [Styling](https://github.com/TimonPost/crossterm#crossterm-type--see-more)
|
||||
- [Cursor](https://github.com/TimonPost/crossterm#cursor--see-more)
|
||||
- [Input](https://github.com/TimonPost/crossterm#input--see-more)
|
||||
- [Terminal](https://github.com/TimonPost/crossterm#terminal--see-more)
|
||||
- [Tested Terminals](https://github.com/TimonPost/crossterm#tested-terminals)
|
||||
- [How it works](https://github.com/TimonPost/crossterm#how-it-works)
|
||||
@ -54,16 +55,16 @@ use self::crossterm::cursor::*;
|
||||
// this mudule is used for terminal related actions
|
||||
use self::crossterm::terminal::*;
|
||||
// this mudule is used for input related actions
|
||||
use self::crossterm::terminal::*;
|
||||
use self::crossterm::input::*;
|
||||
|
||||
```
|
||||
|
||||
## Useful Links
|
||||
|
||||
- Code [documentation](link).
|
||||
- Code [Examples]() (see [branches](LINK_TO_BRANCHES) for previous versions)
|
||||
- [Cargo Page](https://crates.io/crates/crossterm)
|
||||
- [Program Examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples)
|
||||
- Code [documentation](https://docs.rs/crossterm/).
|
||||
- The [Cargo Page](https://crates.io/crates/crossterm)
|
||||
- More real live [examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples)
|
||||
- Detailed [examples](https://github.com/TimonPost/crossterm/tree/master/examples)
|
||||
|
||||
# Features
|
||||
These are the features from this crate:
|
||||
@ -94,14 +95,11 @@ These are the features from this crate:
|
||||
- Read async
|
||||
- Read async until
|
||||
- Exit the current process.
|
||||
- Everything is multithreaded (Send, Sync)
|
||||
- Detailed documentation on every item.
|
||||
- Crossplatform
|
||||
|
||||
## Examples
|
||||
|
||||
For detailed examples of all Crossterm functionalities check the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) directory.
|
||||
|
||||
### Crossterm Type | [see more](Link)
|
||||
### Crossterm Type | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/some_types/mod.rs)
|
||||
This is a wrapper for all the modules crossterm provides like terminal, cursor, styling and input.
|
||||
|
||||
```rust
|
||||
@ -119,7 +117,7 @@ let style = crossterm.style("Black font on Green background color").with(Color::
|
||||
style.paint(&screen);
|
||||
|
||||
```
|
||||
### Styled Font | [see more](Link)
|
||||
### Styled Font | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/color/mod.rs)
|
||||
This module provides the functionalities to style the terminal cursor.
|
||||
```rust
|
||||
use crossterm::style::{Color, style};
|
||||
@ -161,7 +159,7 @@ style("RGB color (10,10,10) ").with(Color::Rgb {
|
||||
style("ANSI color value (50) ").with(Color::AnsiValue(50)).paint(&screen);
|
||||
|
||||
```
|
||||
### Cursor | [see more](LINK)
|
||||
### Cursor | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/cursor/mod.rs)
|
||||
This module provides the functionalities to work with the terminal cursor.
|
||||
|
||||
```rust
|
||||
@ -206,10 +204,10 @@ cursor.blink(true)
|
||||
|
||||
```
|
||||
|
||||
### Input | [see more](LINK)
|
||||
### Input | [see more](https://github.com/TimonPost/crossterm/tree/master/examples/input)
|
||||
This module provides the functionalities to work with terminal input.
|
||||
|
||||
Check [this](link) for handling async input.
|
||||
Check [this](https://github.com/TimonPost/crossterm/blob/master/examples/input/keyboard/async_input.rs) for handling async input.
|
||||
|
||||
```rust
|
||||
|
||||
@ -232,7 +230,7 @@ let mut input = input(&screen);
|
||||
|
||||
```
|
||||
|
||||
### Terminal | [see more](LINK)
|
||||
### Terminal | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/terminal.rs)
|
||||
This module provides the functionalities to work with the terminal in general.
|
||||
|
||||
```rust
|
||||
@ -272,7 +270,7 @@ terminal.exit();
|
||||
terminal.write("Some text\n Some text on new line");
|
||||
```
|
||||
|
||||
Check these links: [AlternateScreen](https://github.com/TimonPost/crossterm/blob/master/examples/Crossterm%200.3.0/terminal/alternate_screen.rs) and [RawScreen](https://github.com/TimonPost/crossterm/blob/master/examples/Crossterm%200.3.0/terminal/raw_mode.rs) for information about how to work with these features.
|
||||
Check these links: [AlternateScreen](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/alternate_screen.rs) and [RawScreen](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/raw_mode.rs) for information about how to work with these features.
|
||||
|
||||
## Tested terminals
|
||||
|
||||
@ -308,7 +306,7 @@ I highly appreciate it when you are contributing to this crate.
|
||||
Also Since my native language is not English my grammar and sentence order will not be perfect.
|
||||
So improving this by correcting these mistakes will help both me and the reader of the docs.
|
||||
|
||||
Check [Contributing](link) for more info about branches and code architecture.
|
||||
Check [Contributing](https://github.com/TimonPost/crossterm/blob/master/docs/Contributing.md) for more info about branches and code architecture.
|
||||
|
||||
## Authors
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
# Features / Fixes in crossterm 0.4.0
|
||||
- Input support (read_line, read_char, read_async, read_until_async)
|
||||
- Styling module improved
|
||||
- This create supports multithreading (`Send`)
|
||||
- Everything is multithreaded (`Send`, `Sync`)
|
||||
- Performance enhancements: removed mutexes, removed state manager, removed context type removed unnecessarily RC types.
|
||||
- Bug fix resetting console color.
|
||||
- Bug fix whit undoing raw modes.
|
||||
- More correct error handling.
|
||||
- Overall commend improvement.
|
||||
- Overall refactor of code.
|
||||
|
||||
# Features in crossterm 0.3.0
|
||||
|
||||
|
@ -19,6 +19,4 @@ use std::io::Write;
|
||||
use std::{thread,time};
|
||||
fn main()
|
||||
{
|
||||
::crossterm::terminal::terminal(&::crossterm::Screen::default()).terminal_size();
|
||||
thread::sleep(time::Duration::from_millis(2000));
|
||||
}
|
||||
|
@ -7,15 +7,18 @@ The programs are:
|
||||
- First depth search:
|
||||
|
||||
This is an search algorithm implemented visually. This program uses the following functionalities: cursor movement, coloring, alternate screen and terminal clearing.
|
||||
To run this use `cargo run` in the directory of first depth search.
|
||||
|
||||
- Snake
|
||||
|
||||
This is a snake game implemented with this library.
|
||||
|
||||
To run this use `cargo run` in the directory of snake.
|
||||
- Command Bar:
|
||||
|
||||
This is a terminal application where multiple threads write to the output while you can enter commands asynchronously.
|
||||
To run this use `cargo run --example command_bar`
|
||||
|
||||
- Logging:
|
||||
|
||||
This is an async logging program to demonstrate asynchronous logging with an queue.
|
||||
To run this use `cargo run --example logging`
|
@ -79,7 +79,6 @@ impl RawModeCommand
|
||||
{
|
||||
pub fn new() -> Self {
|
||||
RawModeCommand {
|
||||
|
||||
mask: ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_LINE_INPUT
|
||||
}
|
||||
}
|
||||
@ -100,13 +99,13 @@ impl RawModeCommand {
|
||||
|
||||
let new_mode = dw_mode & !self.mask;
|
||||
|
||||
// if !kernel::set_console_mode(&stdout, new_mode) {
|
||||
// return Err(Error::new(
|
||||
// ErrorKind::Other,
|
||||
// "Could not set console mode when enabling raw mode",
|
||||
// ));
|
||||
// }
|
||||
self.disable();
|
||||
if !kernel::set_console_mode(&stdout, new_mode) {
|
||||
return Err(Error::new(
|
||||
ErrorKind::Other,
|
||||
"Could not set console mode when enabling raw mode",
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user