Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Moritz Sokoll
btui-rs
Commits
b4a99ae4
Verified
Commit
b4a99ae4
authored
Oct 28, 2021
by
Moritz Sokoll
🦀
Browse files
added column control to Terminal
parent
f5966536
Pipeline
#322
passed with stages
in 1 minute and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Cargo.toml
View file @
b4a99ae4
[package]
name
=
"btui"
version
=
"0.6.
9
"
version
=
"0.6.
10
"
edition
=
"2018"
authors
=
[
"Moritz Sokoll <moritz@sokoll.com>"
]
license
=
"MIT"
...
...
README.md
View file @
b4a99ae4
...
...
@@ -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:
...
...
src/lib.rs
View file @
b4a99ae4
...
...
@@ -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
...
...
src/linux.rs
View file @
b4a99ae4
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
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