2019-09-21 07:50:53 +10:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
use std::io::Result;
|
|
|
|
|
2019-09-16 04:42:12 +10:00
|
|
|
use crossterm_winapi::ScreenBuffer;
|
2019-01-28 07:16:14 +11:00
|
|
|
|
2019-09-21 07:50:53 +10:00
|
|
|
fn print_screen_buffer_information() -> Result<()> {
|
|
|
|
let screen_buffer = ScreenBuffer::current()?;
|
2019-01-28 07:16:14 +11:00
|
|
|
|
|
|
|
// get console screen buffer information
|
2019-09-21 07:50:53 +10:00
|
|
|
let csbi = screen_buffer.info()?;
|
2019-01-28 07:16:14 +11:00
|
|
|
|
|
|
|
println!("cursor post: {:?}", csbi.cursor_pos());
|
|
|
|
println!("attributes: {:?}", csbi.attributes());
|
|
|
|
println!("terminal window dimentions {:?}", csbi.terminal_window());
|
|
|
|
println!("terminal size {:?}", csbi.terminal_size());
|
2019-09-21 07:50:53 +10:00
|
|
|
|
|
|
|
Ok(())
|
2019-01-28 07:16:14 +11:00
|
|
|
}
|
|
|
|
|
2019-09-21 07:50:53 +10:00
|
|
|
fn multiple_screen_buffers() -> Result<()> {
|
2019-01-28 07:16:14 +11:00
|
|
|
// create new screen buffer
|
|
|
|
let screen_buffer = ScreenBuffer::create();
|
|
|
|
|
|
|
|
// which to this screen buffer
|
2019-09-21 07:50:53 +10:00
|
|
|
screen_buffer.show()
|
2019-09-16 04:42:12 +10:00
|
|
|
}
|
|
|
|
|
2019-09-21 07:50:53 +10:00
|
|
|
fn main() -> Result<()> {
|
|
|
|
print_screen_buffer_information()
|
2019-01-28 07:16:14 +11:00
|
|
|
}
|