2020-12-23 20:50:23 +00:00
|
|
|
//! based on the proof of concept at ../../src/poc/cjkscroll.c
|
|
|
|
|
|
|
|
use libnotcurses_sys::*;
|
|
|
|
|
2020-12-25 18:35:21 +00:00
|
|
|
fn main() -> NcResult<()> {
|
2020-12-23 20:50:23 +00:00
|
|
|
|
2020-12-25 18:35:21 +00:00
|
|
|
let nc = Notcurses::new()?;
|
2020-12-23 20:50:23 +00:00
|
|
|
let plane = nc.stdplane();
|
|
|
|
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 {
|
|
|
|
sleep![1];
|
|
|
|
|
|
|
|
if plane.putchar(wc) == NCRESULT_ERR {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
wc = core::char::from_u32(wc as u32 + 1).expect("invalid char");
|
|
|
|
|
|
|
|
if wc == '\u{9fa5}' { // 龣
|
|
|
|
wc = '\u{4e00}';
|
|
|
|
}
|
|
|
|
|
2020-12-25 19:10:31 +00:00
|
|
|
nc.render()?;
|
2020-12-23 20:50:23 +00:00
|
|
|
}
|
2020-12-25 18:35:21 +00:00
|
|
|
nc.stop()?;
|
|
|
|
Ok(())
|
2020-12-23 20:50:23 +00:00
|
|
|
}
|