fixed unix code

This commit is contained in:
= 2018-08-18 15:06:14 +02:00
parent b884891970
commit a6149f75f3
3 changed files with 19 additions and 4 deletions

15
crossterm.iml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUST_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/benches" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -27,7 +27,7 @@ impl RawScreen {
pub fn into_raw_mode() -> io::Result<()>
{
#[cfg(not(target_os = "windows"))]
let mut command = unix_command::RawModeCommand::new();
let mut command = unix_command::NoncanonicalModeCommand::new();
#[cfg(target_os = "windows")]
let mut command = win_commands::RawModeCommand::new();
@ -39,7 +39,7 @@ impl RawScreen {
pub fn disable_raw_modes() -> io::Result<()>
{
#[cfg(not(target_os = "windows"))]
let mut command = unix_command::RawModeCommand::new();
let mut command = unix_command::NoncanonicalModeCommand::new();
#[cfg(target_os = "windows")]
let mut command = win_commands::RawModeCommand::new();

View File

@ -46,8 +46,8 @@ pub fn terminal_size() -> (u16, u16) {
/// Get the current cursor position.
pub fn pos(stdout: &Arc<Stdout>) -> (u16, u16) {
let mut crossterm = Crossterm::new();
let input = crossterm.input(&Screen::default());
let mut crossterm = Crossterm::new(&Screen::default());
let input = crossterm.input();
let delimiter = b'R';
let mut stdin = input.read_until_async(delimiter);