Skip to content

getch() crashes with PDC_WIDE #335

@rhaberkorn

Description

@rhaberkorn

In 4.5.1 (MSYS) the following crashes both in Wincon and WinGUI when pressing a multi-byte non-ANSI key:

#include <pdcurses.h>

int main(void)
{
        initscr();
        getch();
        endwin();
        return 0;
}

Compile with

cc -o getch-utf getch-utf.c -DPDC_WIDE -I/mingw64/include/pdcurses -lpdcurses_wincon -lgdi32 -lcomdlg32 -lwinmm

The assertion is

Assertion failed: count <= n - i, file ../pdcurses/util.c, line 492

This did not happen in 4.4.0, so it's a regression. I would expect to receive the individual bytes of the multi-byte sequence in several getch() calls (every byte as its own keypress event). This is how ncurses behaves as well.

I do not use the get_wch() class of functions as I'd like to stay compatible with non-widechar (n)curses builds for the time being - if that has any real-life significance is another question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions