Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
ransid
Commits
5531d965
Commit
5531d965
authored
Nov 28, 2017
by
Jeremy Soller
Browse files
Fix margins on resize
parent
81314ede
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib.rs
View file @
5531d965
...
...
@@ -634,7 +634,7 @@ impl State {
'r'
=>
{
let
top
=
params
.get
(
0
)
.map
(|
v
|
*
v
)
.unwrap_or
(
1
);
let
bottom
=
params
.get
(
1
)
.map
(|
v
|
*
v
)
.unwrap_or
(
self
.h
as
i64
);
self
.top_margin
=
cmp
::
max
(
0
,
top
as
isize
-
1
)
as
usize
;
self
.top_margin
=
cmp
::
max
(
0
,
cmp
::
min
(
self
.h
as
isize
-
1
,
top
as
isize
-
1
)
)
as
usize
;
self
.bottom_margin
=
cmp
::
max
(
self
.top_margin
as
isize
,
cmp
::
min
(
self
.h
as
isize
-
1
,
bottom
as
isize
-
1
))
as
usize
;
},
's'
=>
{
...
...
@@ -840,6 +840,16 @@ impl Console {
}
}
pub
fn
resize
(
&
mut
self
,
w
:
usize
,
h
:
usize
)
{
let
state
=
&
mut
self
.state
;
state
.top_margin
=
cmp
::
max
(
0
,
cmp
::
min
(
h
as
isize
-
1
,
state
.top_margin
as
isize
))
as
usize
;
state
.bottom_margin
=
cmp
::
max
(
state
.top_margin
as
isize
,
cmp
::
min
(
h
as
isize
-
1
,
state
.bottom_margin
as
isize
+
h
as
isize
-
state
.h
as
isize
))
as
usize
;
state
.w
=
w
;
state
.h
=
h
;
}
pub
fn
write
<
F
:
FnMut
(
Event
)
>
(
&
mut
self
,
bytes
:
&
[
u8
],
mut
callback
:
F
)
{
for
byte
in
bytes
.iter
()
{
self
.parser
.advance
(
&
mut
Performer
{
...
...
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