diff options
author | Keenan Brock <keenan@thebrocks.net> | 2023-04-24 15:04:29 -0400 |
---|---|---|
committer | Keenan Brock <keenan@thebrocks.net> | 2023-04-24 15:04:29 -0400 |
commit | 7ebab0711106a76cace8b81e74f8c540a9a5dc60 (patch) | |
tree | 4b6d6d85cfdec49b8faa3d8975e97cf16ee96306 /lib/highline | |
parent | b617304aef659d778bd0624e76640f4eaece9bda (diff) | |
download | highline-7ebab0711106a76cace8b81e74f8c540a9a5dc60.tar.gz |
Use existing save_stty functionality
Yes, `save_stty` and `restore_stty` should probably not live in terminal, but they do.
No reason to re-implement them. And they handle error cases better.
Diffstat (limited to 'lib/highline')
-rw-r--r-- | lib/highline/terminal/unix_stty.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/highline/terminal/unix_stty.rb b/lib/highline/terminal/unix_stty.rb index ad9c85d..1dbed36 100644 --- a/lib/highline/terminal/unix_stty.rb +++ b/lib/highline/terminal/unix_stty.rb @@ -32,13 +32,13 @@ class HighLine # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode - @state = `stty -g` + save_stty system "stty raw -echo -icanon isig" end # (see Terminal#restore_mode) def restore_mode - system "stty #{@state}" + restore_stty print "\r" end |