mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -05:00
Patch from Yoshida Masato to fill in the missing pieces of Windows
UTF-16 support. High Unicode characters in the terminal are now converted back into surrogates during copy and draw operations, and the Windows drawing code takes account of that when splitting up the UTF-16 string for display. Meanwhile, accidental uses of wchar_t have been replaced with 32-bit integers in parts of the cross-platform code which were expecting not to have to deal with UTF-16. [originally from svn r9409]
This commit is contained in:
10
wcwidth.c
10
wcwidth.c
@ -69,7 +69,7 @@ struct interval {
|
||||
};
|
||||
|
||||
/* auxiliary function for binary search in interval table */
|
||||
static int bisearch(wchar_t ucs, const struct interval *table, int max) {
|
||||
static int bisearch(unsigned int ucs, const struct interval *table, int max) {
|
||||
int min = 0;
|
||||
int mid;
|
||||
|
||||
@ -121,7 +121,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
|
||||
* in ISO 10646.
|
||||
*/
|
||||
|
||||
int mk_wcwidth(wchar_t ucs)
|
||||
int mk_wcwidth(unsigned int ucs)
|
||||
{
|
||||
/* sorted list of non-overlapping intervals of non-spacing characters */
|
||||
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
|
||||
@ -198,7 +198,7 @@ int mk_wcwidth(wchar_t ucs)
|
||||
}
|
||||
|
||||
|
||||
int mk_wcswidth(const wchar_t *pwcs, size_t n)
|
||||
int mk_wcswidth(const unsigned int *pwcs, size_t n)
|
||||
{
|
||||
int w, width = 0;
|
||||
|
||||
@ -221,7 +221,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
|
||||
* the traditional terminal character-width behaviour. It is not
|
||||
* otherwise recommended for general use.
|
||||
*/
|
||||
int mk_wcwidth_cjk(wchar_t ucs)
|
||||
int mk_wcwidth_cjk(unsigned int ucs)
|
||||
{
|
||||
/* sorted list of non-overlapping intervals of East Asian Ambiguous
|
||||
* characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
|
||||
@ -289,7 +289,7 @@ int mk_wcwidth_cjk(wchar_t ucs)
|
||||
}
|
||||
|
||||
|
||||
int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
|
||||
int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n)
|
||||
{
|
||||
int w, width = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user