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
ffd49530
Commit
ffd49530
authored
8 years ago
by
ticki
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:Ticki/libterm
parents
a18e367e
21716b2f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/event.rs
+6
-7
6 additions, 7 deletions
src/event.rs
src/input.rs
+1
-1
1 addition, 1 deletion
src/input.rs
src/raw.rs
+1
-1
1 addition, 1 deletion
src/raw.rs
with
8 additions
and
9 deletions
src/event.rs
+
6
−
7
View file @
ffd49530
...
...
@@ -153,7 +153,7 @@ where I: Iterator<Item = Result<u8, Error>>
c
=
iter
.next
()
.unwrap
()
.unwrap
();
}
let
str_buf
=
String
::
from_utf8
(
buf
)
.unwrap
();
let
ref
mut
nums
=
str_buf
.split
(
';'
);
let
nums
=
&
mut
str_buf
.split
(
';'
);
let
cb
=
nums
.next
()
.unwrap
()
.parse
::
<
u16
>
()
.unwrap
();
let
cx
=
nums
.next
()
.unwrap
()
.parse
::
<
u16
>
()
.unwrap
();
...
...
@@ -192,7 +192,7 @@ where I: Iterator<Item = Result<u8, Error>>
// ESC [ Cb ; Cx ; Cy ; M
b'M'
=>
{
let
str_buf
=
String
::
from_utf8
(
buf
)
.unwrap
();
let
ref
mut
nums
=
str_buf
.split
(
';'
);
let
nums
=
&
mut
str_buf
.split
(
';'
);
let
cb
=
nums
.next
()
.unwrap
()
.parse
::
<
u16
>
()
.unwrap
();
let
cx
=
nums
.next
()
.unwrap
()
.parse
::
<
u16
>
()
.unwrap
();
...
...
@@ -203,7 +203,7 @@ where I: Iterator<Item = Result<u8, Error>>
33
=>
MouseEvent
::
Press
(
MouseButton
::
Middle
,
cx
,
cy
),
34
=>
MouseEvent
::
Press
(
MouseButton
::
Right
,
cx
,
cy
),
35
=>
MouseEvent
::
Release
(
cx
,
cy
),
96
=>
MouseEvent
::
Press
(
MouseButton
::
WheelUp
,
cx
,
cy
),
96
|
97
=>
MouseEvent
::
Press
(
MouseButton
::
WheelUp
,
cx
,
cy
),
_
=>
return
error
,
};
...
...
@@ -264,14 +264,13 @@ fn parse_utf8_char<I>(c: u8, iter: &mut I) -> Result<char, Error>
if
c
.is_ascii
()
{
Ok
(
c
as
char
)
}
else
{
let
ref
mut
bytes
=
Vec
::
new
();
let
bytes
=
&
mut
Vec
::
new
();
bytes
.push
(
c
);
loop
{
bytes
.push
(
iter
.next
()
.unwrap
()
.unwrap
());
match
str
::
from_utf8
(
bytes
)
{
Ok
(
st
)
=>
return
Ok
(
st
.chars
()
.next
()
.unwrap
()),
Err
(
_
)
=>
{},
if
let
Ok
(
st
)
=
str
::
from_utf8
(
bytes
)
{
return
Ok
(
st
.chars
()
.next
()
.unwrap
())
}
if
bytes
.len
()
>=
4
{
return
error
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/input.rs
+
1
−
1
View file @
ffd49530
...
...
@@ -35,7 +35,7 @@ impl<I: Iterator<Item = Result<u8, io::Error>>> Iterator for Events<I> {
type
Item
=
Result
<
Event
,
io
::
Error
>
;
fn
next
(
&
mut
self
)
->
Option
<
Result
<
Event
,
io
::
Error
>>
{
let
ref
mut
iter
=
self
.bytes
;
let
iter
=
&
mut
self
.bytes
;
match
iter
.next
()
{
Some
(
item
)
=>
Some
(
parse_event
(
item
,
iter
)
.or
(
Ok
(
Event
::
Unsupported
))),
None
=>
None
,
...
...
This diff is collapsed.
Click to expand it.
src/raw.rs
+
1
−
1
View file @
ffd49530
...
...
@@ -75,7 +75,7 @@ impl<W: Write> IntoRawMode for W {
use
termios
::{
cfmakeraw
,
get_terminal_attr
,
set_terminal_attr
};
let
(
mut
ios
,
exit
)
=
get_terminal_attr
();
let
prev_ios
=
ios
.clone
()
;
let
prev_ios
=
ios
;
if
exit
!=
0
{
return
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
"Unable to get Termios attribute."
));
}
...
...
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