1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#![allow(dead_code)]
#[cfg(windows)]
use std::io::Result;
#[cfg(windows)]
use crossterm_winapi::ScreenBuffer;
#[cfg(windows)]
fn print_screen_buffer_information() -> Result<()> {
let screen_buffer = ScreenBuffer::current()?;
// get console screen buffer information
let csbi = screen_buffer.info()?;
println!("cursor post: {:?}", csbi.cursor_pos());
println!("attributes: {:?}", csbi.attributes());
println!("terminal window dimentions {:?}", csbi.terminal_window());
println!("terminal size {:?}", csbi.terminal_size());
Ok(())
}
#[cfg(windows)]
fn multiple_screen_buffers() -> Result<()> {
// create new screen buffer
let screen_buffer = ScreenBuffer::create();
// which to this screen buffer
screen_buffer.show()
}
#[cfg(windows)]
fn main() -> Result<()> {
print_screen_buffer_information()
}
#[cfg(not(windows))]
fn main() {
println!("This example is for the Windows platform only.");
}
|