You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
536 B
22 lines
536 B
use crossterm::{ |
|
execute, |
|
terminal::{size, ScrollUp, SetSize, ScrollDown}, |
|
}; |
|
use std::io::{self, Write}; |
|
|
|
fn main() -> io::Result<()> { |
|
let (cols, rows) = size()?; |
|
println!("Cols: {cols}, rows: {rows}"); |
|
|
|
// Resize terminal and scroll up. |
|
execute!(io::stdout(), SetSize(10, 10), ScrollUp(5))?; |
|
for i in 0..11 { |
|
println!("Line {i}"); |
|
} |
|
|
|
execute!(io::stdout(), SetSize(10, 10), ScrollDown(5))?; |
|
|
|
// Be a good citizen, cleanup |
|
execute!(io::stdout(), SetSize(cols, rows))?; |
|
Ok(()) |
|
}
|
|
|