diff --git a/wincon/pdcdisp.c b/wincon/pdcdisp.c index fe14ff3c..7c4c1048 100644 --- a/wincon/pdcdisp.c +++ b/wincon/pdcdisp.c @@ -50,6 +50,8 @@ void PDC_gotoyx(int row, int col) int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */ #endif +#define PDC_NEW_WINCON_WORKAROUND 1 + void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) { CHAR_INFO ci[512]; @@ -108,11 +110,34 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) #endif ci[dst].Char.UnicodeChar = (WCHAR)char_out; +#ifdef PDC_NEW_WINCON_WORKAROUND + sr.Left = x + src; + if( src < len - 1 && + (srcp[src + 1] & A_CHARTEXT) == DUMMY_CHAR_NEXT_TO_FULLWIDTH) + { + /* necessary to erase garbage */ + ci[dst + 1].Char.UnicodeChar = (WCHAR)' '; + ci[dst + 1].Attributes = ci[dst].Attributes; + bufSize.X = 2; + bufSize.Y = 1; + sr.Right = sr.Left + 2; + } + else + { + bufSize.X = 1; + bufSize.Y = 1; + sr.Right = sr.Left + 1; + } + WriteConsoleOutput(pdc_con_out, ci, bufSize, bufPos, &sr); +#else dst++; +#endif } +#ifndef PDC_NEW_WINCON_WORKAROUND bufSize.X = dst; bufSize.Y = 1; WriteConsoleOutput(pdc_con_out, ci, bufSize, bufPos, &sr); +#endif }