启动时 Ncurses 屏幕空白
Ncurses screen blank on start
每当我启动以下程序时,我都会看到一个空屏幕,而不是字符串“hello”:
use ncurses as n;
fn main() {
render::setup_ncurses();
let win = n::newwin(30, 30, 0, 0);
n::waddstr(win, "hello");
n::wrefresh(win);
// n::refresh(); <-- this doesn't work either
n::getch();
// n::wgetch(win); <-- doesn't work either
n::endwin();
}
具有设置功能:
pub fn setup_ncurses() {
// Allows for wide characters
n::setlocale(n::LcCategory::all, "");
n::initscr();
// Captures signal sequences and no buffer
n::raw();
// F keys and arrows
n::keypad(n::stdscr(), true);
// Doesn't echo typed keys
n::noecho();
}
windows 是否有我遗漏的一些奇怪行为?使用 stdscr
.
时不会发生这种情况
变化:
let win = n::newwin(30, 30, 0, 0);
用于:
let win = n::subwin(n::stdscr(), 30, 30, 0, 0);
每当我启动以下程序时,我都会看到一个空屏幕,而不是字符串“hello”:
use ncurses as n;
fn main() {
render::setup_ncurses();
let win = n::newwin(30, 30, 0, 0);
n::waddstr(win, "hello");
n::wrefresh(win);
// n::refresh(); <-- this doesn't work either
n::getch();
// n::wgetch(win); <-- doesn't work either
n::endwin();
}
具有设置功能:
pub fn setup_ncurses() {
// Allows for wide characters
n::setlocale(n::LcCategory::all, "");
n::initscr();
// Captures signal sequences and no buffer
n::raw();
// F keys and arrows
n::keypad(n::stdscr(), true);
// Doesn't echo typed keys
n::noecho();
}
windows 是否有我遗漏的一些奇怪行为?使用 stdscr
.
变化:
let win = n::newwin(30, 30, 0, 0);
用于:
let win = n::subwin(n::stdscr(), 30, 30, 0, 0);