Skip to content

Commit

Permalink
Fix incorrect calculation of codepoint from UTF-16 surrogate pair.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Sep 2, 2023
1 parent 1dd362c commit 378fc4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2850,11 +2850,11 @@ static int console_input(HANDLE tty, XINPUT_RECORD *xip)
}

if (ch >= 0xD800 && ch < 0xDC00) { /* high surrogate */
hi_surr = 0x10000 | ((ch - 0xD800) << 10);
hi_surr = 0x10000 + ((ch - 0xD800) << 10);
return (FALSE);
}
if (ch >= 0xDC00 && ch < 0xE000) { /* low surrogate */
xip->ichar = hi_surr | (ch - 0xDC00);
xip->ichar = hi_surr + (ch - 0xDC00);
hi_surr = 0;
}
}
Expand Down

0 comments on commit 378fc4b

Please sign in to comment.