Skip to content

Commit

Permalink
wgetn_wstr() ought to get characters using wget_wch(), not wgetch(). …
Browse files Browse the repository at this point in the history
…The latter (ought to, soon will) return multi-byte sequences, rather than the Unicode points that are desired in this function.
  • Loading branch information
Bill-Gray committed Jan 6, 2023
1 parent 4257ecd commit 287a53f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pdcurses/getstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static void _clear_preceding_char( WINDOW *win, const int ch)

int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
{
int ch, i, num, x, chars;
int i, num, x, chars;
wint_t *p;
bool stop, oldecho, oldcbreak, oldnodelay;

Expand Down Expand Up @@ -322,7 +322,9 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)

while (!stop)
{
ch = wgetch(win);
wint_t ch;

wget_wch( win, &ch);

switch (ch)
{
Expand Down Expand Up @@ -394,7 +396,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
{
if( ch < KEY_MIN || ch >= KEY_MAX)
{
*p++ = (wint_t)ch;
*p++ = ch;
if (oldecho)
waddch(win, ch);
chars++;
Expand Down

0 comments on commit 287a53f

Please sign in to comment.