Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
d24c6c11
Commit
d24c6c11
authored
8 years ago
by
gwenn
Browse files
Options
Downloads
Patches
Plain Diff
Fix refresh on windows
parent
7d3a26d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+22
-4
22 additions, 4 deletions
src/lib.rs
with
22 additions
and
4 deletions
src/lib.rs
+
22
−
4
View file @
d24c6c11
...
...
@@ -181,15 +181,33 @@ impl<'out, 'prompt> State<'out, 'prompt> {
// calculate the desired position of the cursor
let
cursor
=
calculate_position
(
&
self
.line
[
..
self
.line
.pos
()],
prompt_size
,
self
.cols
);
// position at the
end
of the prompt, clear to end of previous input
// position at the
start
of the prompt, clear to end of previous input
let
mut
info
=
unsafe
{
mem
::
zeroed
()
};
check!
(
kernel32
::
GetConsoleScreenBufferInfo
(
handle
,
&
mut
info
));
info
.dwCursorPosition.X
=
self
.prompt_size.col
as
i16
;
info
.dwCursorPosition.Y
-=
(
self
.cursor.row
-
self
.prompt_size.row
)
as
i16
;
info
.dwCursorPosition.X
=
0
;
info
.dwCursorPosition.Y
-=
self
.cursor.row
as
i16
;
check!
(
kernel32
::
SetConsoleCursorPosition
(
handle
,
info
.dwCursorPosition
));
let
mut
_count
=
0
;
check!
(
kernel32
::
FillConsoleOutputCharacterA
(
handle
,
' '
as
winapi
::
CHAR
,
(
info
.dwSize.X
*
info
.dwSize.Y
)
as
winapi
::
DWORD
,
// FIXME
info
.dwCursorPosition
,
&
mut
_count
));
let
mut
ab
=
String
::
new
();
// display the prompt
ab
.push_str
(
prompt
);
// display the input line
ab
.push_str
(
&
self
.line
);
try
!
(
write_and_flush
(
self
.out
,
ab
.as_bytes
()));
// position the cursor
check!
(
kernel32
::
GetConsoleScreenBufferInfo
(
handle
,
&
mut
info
));
info
.dwCursorPosition.X
=
cursor
.col
as
i16
;
info
.dwCursorPosition.Y
-=
(
end_pos
.row
-
cursor
.row
)
as
i16
;
check!
(
kernel32
::
SetConsoleCursorPosition
(
handle
,
info
.dwCursorPosition
));
self
.cursor
=
cursor
;
unimplemented!
()
Ok
(
()
)
}
fn
update_columns
(
&
mut
self
)
{
...
...
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