WSL显示框的NCurses错误 [英] NCurses with WSL Displaying Boxes Incorrectly
问题描述
我在Windows计算机上使用ubuntu,并使用Windows子系统(用于Linux)来编译简单的程序,该程序使用C语言中的ncurses来显示ncurses窗口内的一个框.如下图所示,该框无法完全呈现.我的代码有问题吗?还是WSL中的问题?
I am using ubuntu on my windows computer using the windows subsystem for linux to compile a simple program using ncurses in C that shows a box inside a ncurses window. As seen in the picture below, the box does not render fully. Is there something wrong with my code or is this an issue within WSL?
绘制的框显示不正确 盒子应该伸展并连接左右两侧
The drawn box displays incorrectly The box should stretch and connect the left and right sides
int main()
{
initscr();
noecho();
cbreak();
int sizeY, sizeX;
getmaxyx(stdscr, sizeY, sizeX);
WINDOW *mainMenu = newwin(10, 10, 5, 10);
box(mainMenu, 0, 0);
refresh();
wrefresh(mainMenu);
keypad(mainMenu, true);
getch();
endwin();
return 0;
}
推荐答案
getch();
应该为wgetch(mainMenu);
否则,重新粉刷stdscr
可能会擦掉mainWindow
的一部分.
The getch();
should be wgetch(mainMenu);
Otherwise, repainting stdscr
can wipe out part of the mainWindow
.
但这似乎不是图片中显示的问题.这可能是在与 xterm 不完全匹配的某些终端上使用TERM=xterm
(或TERM=xterm-256color
),例如,
But that does not appear to be the problem shown in the picture. That's probably using TERM=xterm
(or TERM=xterm-256color
) on some terminal that doesn't completely match xterm, e.g., the repeat feature.
这篇关于WSL显示框的NCurses错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!