mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 19:45:46 +00:00
d5f5648b37
We use cargo vendor to generate a .cargo/config file and the vendor directory. Vendoring allows us to lock our dependencies and to modify them easily from the top level Cargo.toml. We vendor all dependencies, including the crates.io ones, which allows for network isolated builds. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
36 lines
975 B
Rust
36 lines
975 B
Rust
extern crate termion;
|
|
|
|
use termion::event::{Key, Event, MouseEvent};
|
|
use termion::input::{TermRead, MouseTerminal};
|
|
use termion::raw::IntoRawMode;
|
|
use std::io::{Write, stdout, stdin};
|
|
|
|
fn main() {
|
|
let stdin = stdin();
|
|
let mut stdout = MouseTerminal::from(stdout().into_raw_mode().unwrap());
|
|
|
|
write!(stdout,
|
|
"{}{}q to exit. Click, click, click!",
|
|
termion::clear::All,
|
|
termion::cursor::Goto(1, 1))
|
|
.unwrap();
|
|
stdout.flush().unwrap();
|
|
|
|
for c in stdin.events() {
|
|
let evt = c.unwrap();
|
|
match evt {
|
|
Event::Key(Key::Char('q')) => break,
|
|
Event::Mouse(me) => {
|
|
match me {
|
|
MouseEvent::Press(_, x, y) => {
|
|
write!(stdout, "{}x", termion::cursor::Goto(x, y)).unwrap();
|
|
}
|
|
_ => (),
|
|
}
|
|
}
|
|
_ => {}
|
|
}
|
|
stdout.flush().unwrap();
|
|
}
|
|
}
|