Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
TimonPost committed Jan 27, 2023
1 parent 4a645bf commit 20d0a3e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
7 changes: 3 additions & 4 deletions src/cursor.rs
Expand Up @@ -330,7 +330,7 @@ impl Command for Show {
/// A command that enables blinking of the terminal cursor.
///
/// See `SetCursorStyle` which is more advanced and better supported.
///
///
/// # Notes
///
/// - Windows versions lower than Windows 10 do not support this functionality.
Expand All @@ -347,9 +347,8 @@ impl Command for EnableBlinking {
}
}


/// A command that disables blinking of the terminal cursor.
///
///
/// See `SetCursorStyle` which is more advanced and better supported.
///
/// # Notes
Expand All @@ -370,7 +369,7 @@ impl Command for DisableBlinking {

/// A command that sets the style of the cursor.
/// It uses two types of escape codes, one to control blinking, and the other the shape.
///
///
/// # Note
///
/// - Commands must be executed/queued for execution otherwise they do nothing.
Expand Down
2 changes: 1 addition & 1 deletion src/event/source/unix.rs
Expand Up @@ -8,4 +8,4 @@ pub(crate) mod mio;
pub(crate) use self::tty::UnixInternalEventSource;

#[cfg(not(feature = "use-dev-tty"))]
pub(crate) use self::mio::UnixInternalEventSource;
pub(crate) use self::mio::UnixInternalEventSource;
14 changes: 6 additions & 8 deletions src/event/source/unix/tty.rs
Expand Up @@ -12,15 +12,13 @@ use filedescriptor::{poll, pollfd, POLLIN};
#[cfg(feature = "event-stream")]
use crate::event::sys::Waker;

use crate::{
event::{
sys::unix::{
file_descriptor::{tty_fd, FileDesc},
parse::parse_event,
},
InternalEvent,
source::EventSource,
use crate::event::{
source::EventSource,
sys::unix::{
file_descriptor::{tty_fd, FileDesc},
parse::parse_event,
},
InternalEvent,
};

/// Holds a prototypical Waker and a receiver we can wait on when doing select().
Expand Down
2 changes: 1 addition & 1 deletion src/event/sys/unix/file_descriptor.rs
Expand Up @@ -37,7 +37,7 @@ impl FileDesc {
self.fd,
buffer.as_mut_ptr() as *mut libc::c_void,
size as size_t,
)
)
};

if result < 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/event/sys/unix/waker.rs
Expand Up @@ -8,4 +8,4 @@ pub(crate) mod mio;
pub(crate) use self::tty::Waker;

#[cfg(not(feature = "use-dev-tty"))]
pub(crate) use self::mio::Waker;
pub(crate) use self::mio::Waker;
2 changes: 1 addition & 1 deletion src/event/sys/unix/waker/mio.rs
Expand Up @@ -33,4 +33,4 @@ impl Waker {
pub(crate) fn reset(&self) -> Result<()> {
Ok(())
}
}
}
14 changes: 11 additions & 3 deletions src/event/sys/windows/parse.rs
Expand Up @@ -13,7 +13,7 @@ use winapi::um::{
};

use crate::{
event::{Event, KeyCode, KeyEvent, KeyModifiers, MouseButton, MouseEventKind, KeyEventKind},
event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind},
Result,
};

Expand Down Expand Up @@ -221,7 +221,11 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<WindowsKeyEvent>
// values.
let ch = std::char::from_u32(unicode_scalar_value as u32).unwrap();
let key_code = KeyCode::Char(ch);
let kind = if key_event.key_down { KeyEventKind::Press } else { KeyEventKind::Release };
let kind = if key_event.key_down {
KeyEventKind::Press
} else {
KeyEventKind::Release
};
let key_event = KeyEvent::new_with_kind(key_code, modifiers, kind);
return Some(WindowsKeyEvent::KeyEvent(key_event));
}
Expand Down Expand Up @@ -280,7 +284,11 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<WindowsKeyEvent>
};

if let Some(key_code) = parse_result {
let kind = if key_event.key_down { KeyEventKind::Press } else { KeyEventKind::Release };
let kind = if key_event.key_down {
KeyEventKind::Press
} else {
KeyEventKind::Release
};
let key_event = KeyEvent::new_with_kind(key_code, modifiers, kind);
return Some(WindowsKeyEvent::KeyEvent(key_event));
}
Expand Down

0 comments on commit 20d0a3e

Please sign in to comment.