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
a6f36b6d
Commit
a6f36b6d
authored
8 years ago
by
gwenn
Browse files
Options
Downloads
Patches
Plain Diff
Fix Ctrl-Z (#20)
parent
4dd0cb77
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lib.rs
+1
-3
1 addition, 3 deletions
src/lib.rs
src/tty/test.rs
+5
-0
5 additions, 0 deletions
src/tty/test.rs
src/tty/unix.rs
+8
-0
8 additions, 0 deletions
src/tty/unix.rs
with
14 additions
and
3 deletions
src/lib.rs
+
1
−
3
View file @
a6f36b6d
...
@@ -43,8 +43,6 @@ use std::io::{self, Write};
...
@@ -43,8 +43,6 @@ use std::io::{self, Write};
use
std
::
mem
;
use
std
::
mem
;
use
std
::
path
::
Path
;
use
std
::
path
::
Path
;
use
std
::
result
;
use
std
::
result
;
#[cfg(unix)]
use
nix
::
sys
::
signal
;
use
tty
::{
RawMode
,
RawReader
,
Terminal
,
Term
};
use
tty
::{
RawMode
,
RawReader
,
Terminal
,
Term
};
use
completion
::{
Completer
,
longest_common_prefix
};
use
completion
::{
Completer
,
longest_common_prefix
};
...
@@ -937,7 +935,7 @@ fn readline_edit<C: Completer>(prompt: &str,
...
@@ -937,7 +935,7 @@ fn readline_edit<C: Completer>(prompt: &str,
#[cfg(unix)]
#[cfg(unix)]
KeyPress
::
Ctrl
(
'Z'
)
=>
{
KeyPress
::
Ctrl
(
'Z'
)
=>
{
try
!
(
original_mode
.disable_raw_mode
());
try
!
(
original_mode
.disable_raw_mode
());
try
!
(
signal
::
raise
(
signal
::
SIGSTOP
));
try
!
(
tty
::
suspend
(
));
try
!
(
s
.term
.enable_raw_mode
());
// TODO original_mode may have changed
try
!
(
s
.term
.enable_raw_mode
());
// TODO original_mode may have changed
try
!
(
s
.refresh_line
())
try
!
(
s
.refresh_line
())
}
}
...
...
This diff is collapsed.
Click to expand it.
src/tty/test.rs
+
5
−
0
View file @
a6f36b6d
...
@@ -140,3 +140,8 @@ impl Term for DummyTerminal {
...
@@ -140,3 +140,8 @@ impl Term for DummyTerminal {
Ok
(())
Ok
(())
}
}
}
}
#[cfg(unix)]
pub
fn
suspend
()
->
Result
<
()
>
{
Ok
(())
}
This diff is collapsed.
Click to expand it.
src/tty/unix.rs
+
8
−
0
View file @
a6f36b6d
...
@@ -325,6 +325,14 @@ impl Term for PosixTerminal {
...
@@ -325,6 +325,14 @@ impl Term for PosixTerminal {
}
}
}
}
#[cfg(unix)]
pub
fn
suspend
()
->
Result
<
()
>
{
// For macos:
try
!
(
signal
::
kill
(
nix
::
unistd
::
getppid
(),
signal
::
SIGTSTP
));
try
!
(
signal
::
kill
(
nix
::
unistd
::
getpid
(),
signal
::
SIGTSTP
));
Ok
(())
}
#[cfg(all(unix,test))]
#[cfg(all(unix,test))]
mod
test
{
mod
test
{
#[test]
#[test]
...
...
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