mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
colloquy: block on input before exiting #320
This commit is contained in:
parent
9d7d7ebd8a
commit
5994eee711
20
src/colloquy/Cargo.lock
generated
20
src/colloquy/Cargo.lock
generated
@ -104,6 +104,7 @@ dependencies = [
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"notcurses 1.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -154,6 +155,15 @@ name = "libc"
|
||||
version = "0.2.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc-stdhandle"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.5.2"
|
||||
@ -196,6 +206,15 @@ dependencies = [
|
||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notcurses"
|
||||
version = "1.2.4"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc-stdhandle 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
@ -360,6 +379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||
"checksum libc-stdhandle 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6dac2473dc28934c5e0b82250dab231c9d3b94160d91fe9ff483323b05797551"
|
||||
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||
"checksum libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69cd13c04e971783d60cc48e307d2dfd47f6cad8a1519d0c2439316db7eb31f8"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
|
@ -10,7 +10,9 @@ homepage = "https://nick-black.com/dankwiki/index.php/Notcurses"
|
||||
|
||||
[dependencies]
|
||||
libc = ">= 0.2.66"
|
||||
libnotcurses-sys = ">= 1.2.3"
|
||||
#notcurses = ">= 1.2.5"
|
||||
libnotcurses-sys = ">= 1.2.4"
|
||||
notcurses = { path = "/home/dank/src/dankamongmen/notcurses-1.2.4/rust/notcurses" }
|
||||
|
||||
[dependencies.clap]
|
||||
version = ">= 2.33.0"
|
||||
|
@ -1,3 +1,4 @@
|
||||
extern crate notcurses;
|
||||
extern crate libnotcurses_sys as ffi;
|
||||
|
||||
extern {
|
||||
@ -8,12 +9,6 @@ fn main() {
|
||||
use clap::{load_yaml, App};
|
||||
let yaml = load_yaml!("cli.yml");
|
||||
let matches = App::from_yaml(yaml).get_matches();
|
||||
if matches.is_present("msgbox") {
|
||||
// do a messagebox
|
||||
}else{
|
||||
eprintln!("Needed a widget type");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
unsafe{
|
||||
let _ = libc::setlocale(libc::LC_ALL, std::ffi::CString::new("").unwrap().as_ptr());
|
||||
@ -26,12 +21,25 @@ fn main() {
|
||||
no_winch_sighandler: false,
|
||||
no_quit_sighandlers: false,
|
||||
renderfp: std::ptr::null_mut(),
|
||||
margin_t: 0,
|
||||
margin_r: 0,
|
||||
margin_b: 0,
|
||||
margin_l: 0,
|
||||
margin_t: 4,
|
||||
margin_r: 4,
|
||||
margin_b: 4,
|
||||
margin_l: 4,
|
||||
};
|
||||
let nc = ffi::notcurses_init(&opts, libc_stdout());
|
||||
let stdplane = ffi::notcurses_stdplane(nc);
|
||||
let mut dimy = 0;
|
||||
let mut dimx = 0;
|
||||
ffi::ncplane_dim_yx(stdplane, &mut dimy, &mut dimx);
|
||||
if matches.is_present("msgbox") {
|
||||
ffi::ncplane_new(nc, dimy, dimx, 0, 0, std::ptr::null_mut());
|
||||
}else{
|
||||
eprintln!("Needed a widget type");
|
||||
ffi::notcurses_stop(nc);
|
||||
std::process::exit(1);
|
||||
}
|
||||
let mut ni: ffi::ncinput = std::mem::zeroed();
|
||||
notcurses::notcurses_getc_blocking(nc, &mut ni);
|
||||
ffi::notcurses_stop(nc);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user