summaryrefslogtreecommitdiffstats
path: root/vendor/nu-ansi-term/src/windows.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/nu-ansi-term/src/windows.rs (renamed from vendor/ansi_term/src/windows.rs)17
1 files changed, 9 insertions, 8 deletions
diff --git a/vendor/ansi_term/src/windows.rs b/vendor/nu-ansi-term/src/windows.rs
index fcf02ecf6..828e35573 100644
--- a/vendor/ansi_term/src/windows.rs
+++ b/vendor/nu-ansi-term/src/windows.rs
@@ -25,7 +25,8 @@ pub fn enable_ansi_support() -> Result<(), u32> {
unsafe {
// ref: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
// Using `CreateFileW("CONOUT$", ...)` to retrieve the console handle works correctly even if STDOUT and/or STDERR are redirected
- let console_out_name: Vec<u16> = OsStr::new("CONOUT$").encode_wide().chain(once(0)).collect();
+ let console_out_name: Vec<u16> =
+ OsStr::new("CONOUT$").encode_wide().chain(once(0)).collect();
let console_handle = CreateFileW(
console_out_name.as_ptr(),
GENERIC_READ | GENERIC_WRITE,
@@ -35,27 +36,27 @@ pub fn enable_ansi_support() -> Result<(), u32> {
0,
null_mut(),
);
- if console_handle == INVALID_HANDLE_VALUE
- {
+ if console_handle == INVALID_HANDLE_VALUE {
return Err(GetLastError());
}
// ref: https://docs.microsoft.com/en-us/windows/console/getconsolemode
let mut console_mode: u32 = 0;
- if 0 == GetConsoleMode(console_handle, &mut console_mode)
- {
+ if 0 == GetConsoleMode(console_handle, &mut console_mode) {
return Err(GetLastError());
}
// VT processing not already enabled?
if console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0 {
// https://docs.microsoft.com/en-us/windows/console/setconsolemode
- if 0 == SetConsoleMode(console_handle, console_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
- {
+ if 0 == SetConsoleMode(
+ console_handle,
+ console_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING,
+ ) {
return Err(GetLastError());
}
}
}
- return Ok(());
+ Ok(())
}