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
ab12a8f8
Commit
ab12a8f8
authored
8 years ago
by
IGI-111
Browse files
Options
Downloads
Patches
Plain Diff
fixed formatting
parent
206c61de
No related branches found
No related tags found
1 merge request
!29
Implemented mouse input
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/raw.rs
+7
-9
7 additions, 9 deletions
src/raw.rs
with
7 additions
and
9 deletions
src/raw.rs
+
7
−
9
View file @
ab12a8f8
...
...
@@ -28,7 +28,7 @@ pub struct RawTerminal<W: Write> {
#[cfg(not(target_os
=
"redox"
))]
impl
<
W
>
RawTerminal
<
W
>
where
W
:
Write
where
W
:
Write
{
/// Enable mouse support.
pub
fn
with_mouse
(
mut
self
)
->
io
::
Result
<
MouseTerminal
<
W
>>
{
...
...
@@ -73,9 +73,9 @@ impl<W: Write> Write for RawTerminal<W> {
pub
trait
IntoRawMode
:
Write
+
Sized
{
/// Switch to raw mode.
///
/// Raw mode means that stdin won't be printed (it will instead have to be written manually by
the
/// program). Furthermore, the input isn't canonicalised or buffered (that is, you can
read from
/// stdin one byte of a time). The output is neither modified in any way.
/// Raw mode means that stdin won't be printed (it will instead have to be written manually by
///
the
program). Furthermore, the input isn't canonicalised or buffered (that is, you can
///
read from
stdin one byte of a time). The output is neither modified in any way.
fn
into_raw_mode
(
self
)
->
io
::
Result
<
RawTerminal
<
Self
>>
;
}
...
...
@@ -110,19 +110,17 @@ impl<W: Write> IntoRawMode for W {
use
control
::
TermWrite
;
self
.csi
(
b"r"
)
.map
(|
_
|
{
let
mut
res
=
RawTerminal
{
output
:
self
,
};
let
mut
res
=
RawTerminal
{
output
:
self
};
res
})
}
}
/// A sequence of escape codes to enable terminal mouse support.
const
ENTER_MOUSE_SEQUENCE
:
&
'static
[
u8
]
=
b"
\x1b
[?1000h
\x1b
[?1002h
\x1b
[?1015h
\x1b
[?1006h"
;
const
ENTER_MOUSE_SEQUENCE
:
&
'static
[
u8
]
=
b"
\x1b
[?1000h
\x1b
[?1002h
\x1b
[?1015h
\x1b
[?1006h"
;
/// A sequence of escape codes to disable terminal mouse support.
const
EXIT_MOUSE_SEQUENCE
:
&
'static
[
u8
]
=
b"
\x1b
[?1006l
\x1b
[?1015l
\x1b
[?1002l
\x1b
[?1000l"
;
const
EXIT_MOUSE_SEQUENCE
:
&
'static
[
u8
]
=
b"
\x1b
[?1006l
\x1b
[?1015l
\x1b
[?1002l
\x1b
[?1000l"
;
/// A `RawTerminal` with added mouse support.
///
...
...
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