Add unsafe block around ncurses::stdscr

One more reason to avoid ncurses
This commit is contained in:
Alexandre Bury 2016-09-21 11:57:19 -07:00
parent 93980a7d0c
commit a064400b6f

View File

@ -12,19 +12,19 @@ impl backend::Backend for NcursesBackend {
::std::env::set_var("ESCDELAY", "25"); ::std::env::set_var("ESCDELAY", "25");
ncurses::setlocale(ncurses::LcCategory::all, ""); ncurses::setlocale(ncurses::LcCategory::all, "");
ncurses::initscr(); ncurses::initscr();
ncurses::keypad(ncurses::stdscr, true); ncurses::keypad(unsafe { ncurses::stdscr }, true);
ncurses::noecho(); ncurses::noecho();
ncurses::cbreak(); ncurses::cbreak();
ncurses::start_color(); ncurses::start_color();
ncurses::curs_set(ncurses::CURSOR_VISIBILITY::CURSOR_INVISIBLE); ncurses::curs_set(ncurses::CURSOR_VISIBILITY::CURSOR_INVISIBLE);
ncurses::wbkgd(ncurses::stdscr, ncurses::wbkgd(unsafe { ncurses::stdscr },
ncurses::COLOR_PAIR(ColorStyle::Background.id())); ncurses::COLOR_PAIR(ColorStyle::Background.id()));
} }
fn screen_size() -> (usize, usize) { fn screen_size() -> (usize, usize) {
let mut x: i32 = 0; let mut x: i32 = 0;
let mut y: i32 = 0; let mut y: i32 = 0;
ncurses::getmaxyx(ncurses::stdscr, &mut y, &mut x); ncurses::getmaxyx(unsafe { ncurses::stdscr }, &mut y, &mut x);
(x as usize, y as usize) (x as usize, y as usize)
} }