Don't output the second CHAR_INFO of a full-width pair.
The second cell can still have a different color than the first cell, and *maybe* we want to output it. I'm unsure. It could perhaps matter for a character appearing at the end of a line, but it seems unlikely to matter in practice. Fixes https://github.com/rprichard/winpty/issues/41
This commit is contained in:
parent
a66de7dc28
commit
cce293dd40
@ -46,6 +46,11 @@ const int TERMINAL_WHITE = 7;
|
||||
const int TERMINAL_FOREGROUND = 30;
|
||||
const int TERMINAL_BACKGROUND = 40;
|
||||
|
||||
// Work around the old MinGW, which lacks COMMON_LVB_LEADING_BYTE and
|
||||
// COMMON_LVB_TRAILING_BYTE.
|
||||
const int WINPTY_COMMON_LVB_LEADING_BYTE = 0x100;
|
||||
const int WINPTY_COMMON_LVB_TRAILING_BYTE = 0x200;
|
||||
|
||||
Terminal::Terminal(NamedPipe *output) :
|
||||
m_output(output),
|
||||
m_remoteLine(0),
|
||||
@ -143,6 +148,12 @@ void Terminal::sendLine(int line, CHAR_INFO *lineData, int width)
|
||||
length = termLine.size();
|
||||
m_remoteColor = color;
|
||||
}
|
||||
if (lineData[i].Attributes & WINPTY_COMMON_LVB_TRAILING_BYTE) {
|
||||
// CJK full-width characters occupy two console cells. The first
|
||||
// cell is marked with COMMON_LVB_LEADING_BYTE, and the second is
|
||||
// marked with COMMON_LVB_TRAILING_BYTE. Skip the trailing cells.
|
||||
continue;
|
||||
}
|
||||
// TODO: Is it inefficient to call WideCharToMultiByte once per
|
||||
// character?
|
||||
char mbstr[16];
|
||||
|
Loading…
Reference in New Issue
Block a user