Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
termion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
akitsu-sanae
termion
Commits
8bcb946b
Commit
8bcb946b
authored
8 years ago
by
ticki
Browse files
Options
Downloads
Patches
Plain Diff
Update readme
parent
49bb0932
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-1
2 additions, 1 deletion
README.md
src/control.rs
+14
-0
14 additions, 0 deletions
src/control.rs
src/raw.rs
+2
-0
2 additions, 0 deletions
src/raw.rs
with
18 additions
and
1 deletion
README.md
+
2
−
1
View file @
8bcb946b
...
...
@@ -16,6 +16,7 @@ Features
--------
-
Raw mode.
-
256-color mode.
-
Cursor movement.
-
Color output.
-
Text formatting.
...
...
@@ -24,9 +25,9 @@ Features
-
Termios control.
-
Password input.
-
Redox support.
-
256-color mode.
-
Panic-free error handling.
-
Special keys events (modifiers, special keys, etc.).
-
Allocation-free.
-
Asynchronous key events.
and much more.
...
...
This diff is collapsed.
Click to expand it.
src/control.rs
+
14
−
0
View file @
8bcb946b
...
...
@@ -19,30 +19,37 @@ pub trait TermWrite {
fn
clear
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"2J"
)
}
/// Clear everything _after_ the cursor.
fn
clear_after
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"J"
)
}
/// Clear everything _before_ the cursor.
fn
clear_before
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"1J"
)
}
/// Clear the current line.
fn
clear_line
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"2K"
)
}
/// Clear from the cursor until newline.
fn
clear_until_newline
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"K"
)
}
/// Show the cursor.
fn
show_cursor
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"?25h"
)
}
/// Hide the cursor.
fn
hide_cursor
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"?25l"
)
}
/// Move the cursor `num` spaces to the left.
fn
move_cursor_left
(
&
mut
self
,
num
:
u32
)
->
io
::
Result
<
usize
>
{
if
num
>
0
{
...
...
@@ -80,6 +87,7 @@ pub trait TermWrite {
fn
reset
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"m"
)
}
/// Restore the defaults.
///
/// This will reset color, position, cursor state, and so on. It is recommended that you use
...
...
@@ -110,6 +118,7 @@ pub trait TermWrite {
b'H'
,
])
}
/// Set graphic rendition.
fn
rendition
(
&
mut
self
,
r
:
u8
)
->
io
::
Result
<
usize
>
{
self
.csi
(
&
[
...
...
@@ -119,6 +128,7 @@ pub trait TermWrite {
b'm'
,
])
}
/// Set foreground color.
fn
color
(
&
mut
self
,
color
:
Color
)
->
io
::
Result
<
usize
>
{
let
ansi
=
color
.to_ansi_val
();
...
...
@@ -134,6 +144,7 @@ pub trait TermWrite {
b'm'
,
])
}
/// Set background color.
fn
bg_color
(
&
mut
self
,
color
:
Color
)
->
io
::
Result
<
usize
>
{
let
ansi
=
color
.to_ansi_val
();
...
...
@@ -149,6 +160,7 @@ pub trait TermWrite {
b'm'
,
])
}
/// Set rendition mode (SGR).
fn
style
(
&
mut
self
,
mode
:
Style
)
->
io
::
Result
<
usize
>
{
self
.rendition
(
mode
as
u8
)
...
...
@@ -159,9 +171,11 @@ impl<W: Write> TermWrite for W {
fn
csi
(
&
mut
self
,
b
:
&
[
u8
])
->
io
::
Result
<
usize
>
{
Ok
(
try
!
(
self
.write
(
b"
\x1B
["
))
+
try
!
(
self
.write
(
b
)))
}
fn
osc
(
&
mut
self
,
b
:
&
[
u8
])
->
io
::
Result
<
usize
>
{
Ok
(
try
!
(
self
.write
(
b"
\x1B
]"
))
+
try
!
(
self
.write
(
b
)))
}
fn
dsc
(
&
mut
self
,
b
:
&
[
u8
])
->
io
::
Result
<
usize
>
{
Ok
(
try
!
(
self
.write
(
b"
\x1B
P"
))
+
try
!
(
self
.write
(
b
)))
}
...
...
This diff is collapsed.
Click to expand it.
src/raw.rs
+
2
−
0
View file @
8bcb946b
...
...
@@ -41,6 +41,7 @@ impl<W: Write> Deref for RawTerminal<W> {
&
self
.output
}
}
impl
<
W
:
Write
>
DerefMut
for
RawTerminal
<
W
>
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
W
{
&
mut
self
.output
...
...
@@ -91,6 +92,7 @@ impl<W: Write> IntoRawMode for W {
})
}
}
#[cfg(target_os
=
"redox"
)]
fn
into_raw_mode
(
mut
self
)
->
io
::
Result
<
RawTerminal
<
W
>>
{
use
control
::
TermWrite
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment