Verified Commit b4a99ae4 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

added column control to Terminal

parent f5966536
Pipeline #322 passed with stages
in 1 minute and 31 seconds
[package]
name = "btui"
version = "0.6.9"
version = "0.6.10"
edition = "2018"
authors = ["Moritz Sokoll <moritz@sokoll.com>"]
license = "MIT"
......
......@@ -5,7 +5,7 @@
## Usage
Add this to your `Cargo.toml` dependency list:
```toml
btui = "0.6.8"
btui = "0.6.10"
```
## Features
This crate supports some different features:
......
......@@ -4,7 +4,7 @@
//! with btui you can create beautiful text user interfaces for the terminal.
//! To get started add `btui` as a dependency to your project:
//! ```toml
//! btui = "0.6.8"
//! btui = "0.6.10"
//! ```
//!
//! # Examples
......
......@@ -198,12 +198,20 @@ impl Terminal {
/// *`x`: the x position to move to
/// *`y`: the y position to move to
pub fn set_cursor(&self, x: usize, y: usize) -> Result<(), Error> {
match self.print(format!("\x1b[{};{}H", x, y)) {
Ok(()) => Ok(()),
Err(e) => Err(e),
self.print(format!("\x1b[{};{}H", x, y))
}
/// set the cursors x position
/// # Arguments
/// *`x`: the x position to move to
pub fn set_cursor_x(&self, x: usize) -> Result<(), Error> {
self.print(format!("\x1b[{}G", x))
}
// }}}
// display control: {{{
/// clear the current line
pub fn clear_line(&self) -> Result<(), Error> {
self.print("\x1b[2K")
......@@ -220,6 +228,7 @@ impl Terminal {
}
// }}}
}
impl Default for Terminal {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment