0

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;
}
Brian Koch
  • 13
  • 5

1 Answers1

2

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.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105