NCurses with WSL Displaying Boxes Incorrectly

不打扰是莪最后的温柔 提交于 2019-12-11 18:31:19

问题


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;
}

回答1:


The getch(); should be wgetch(mainMenu); Otherwise, repainting stdscr can wipe out part of the mainWindow.

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.



来源:https://stackoverflow.com/questions/55145136/ncurses-with-wsl-displaying-boxes-incorrectly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!