Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions wincon/pdcdisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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
}