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
redox-os
termion
Commits
d1b3cf66
Commit
d1b3cf66
authored
8 years ago
by
MovingtoMars
Browse files
Options
Downloads
Patches
Plain Diff
add move_cursor_{left,right} to TermWrite
parent
119cbda7
No related branches found
No related tags found
1 merge request
!22
add move_cursor_{left,right} to TermWrite
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/control.rs
+26
-0
26 additions, 0 deletions
src/control.rs
with
26 additions
and
0 deletions
src/control.rs
+
26
−
0
View file @
d1b3cf66
...
@@ -43,6 +43,32 @@ pub trait TermWrite {
...
@@ -43,6 +43,32 @@ pub trait TermWrite {
fn
hide_cursor
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
fn
hide_cursor
(
&
mut
self
)
->
io
::
Result
<
usize
>
{
self
.csi
(
b"?25l"
)
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
{
self
.csi
(
&
[
b'0'
+
(
num
/
10000
)
as
u8
,
b'0'
+
(
num
/
1000
)
as
u8
%
10
,
b'0'
+
(
num
/
100
)
as
u8
%
10
,
b'0'
+
(
num
/
10
)
as
u8
%
10
,
b'0'
+
num
as
u8
%
10
,
b'C'
])
}
else
{
Ok
(
0
)
}
}
/// Move the cursor `num` spaces to the right.
fn
move_cursor_right
(
&
mut
self
,
num
:
u32
)
->
io
::
Result
<
usize
>
{
if
num
>
0
{
self
.csi
(
&
[
b'0'
+
(
num
/
10000
)
as
u8
,
b'0'
+
(
num
/
1000
)
as
u8
%
10
,
b'0'
+
(
num
/
100
)
as
u8
%
10
,
b'0'
+
(
num
/
10
)
as
u8
%
10
,
b'0'
+
num
as
u8
%
10
,
b'D'
])
}
else
{
Ok
(
0
)
}
}
// TODO
// TODO
// fn mode
// fn mode
...
...
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