notcurses/rust/examples/poc-cjkscroll.rs

26 lines
509 B
Rust
Raw Normal View History

2020-12-23 20:50:23 +00:00
//! based on the proof of concept at ../../src/poc/cjkscroll.c
use libnotcurses_sys::*;
fn main() -> NcResult<()> {
let mut nc = Nc::new()?;
let plane = nc.stdplane();
2020-12-23 20:50:23 +00:00
plane.set_scrolling(true);
2020-12-24 01:47:26 +00:00
let mut wc = '\u{4e00}'; // 一
2020-12-23 20:50:23 +00:00
loop {
plane.putchar(wc)?;
2020-12-23 20:50:23 +00:00
wc = core::char::from_u32(wc as u32 + 1).expect("invalid char");
// 龣
if wc == '\u{9fa5}' {
2020-12-23 20:50:23 +00:00
wc = '\u{4e00}';
}
rsleep![&mut nc, 0, 0, 30];
2020-12-23 20:50:23 +00:00
}
// nc.stop()?;
2020-12-23 20:50:23 +00:00
}