Skip to content

Commit

Permalink
Read and write UTF-16, not Ascii.
Browse files Browse the repository at this point in the history
  • Loading branch information
rprichard committed Sep 23, 2015
1 parent 0f7a565 commit 72557cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions agent/Agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void Agent::scanForDirtyLines()
m_console->read(lineRect, lineData);
for (int col = 0; col < windowRect.width(); ++col) {
int newAttr = lineData[col].Attributes;
if (lineData[col].Char.AsciiChar != ' ' || attr!= newAttr)
if (lineData[col].Char.UnicodeChar != L' ' || attr != newAttr)
m_dirtyLineCount = line + 1;
newAttr = attr;
}
Expand Down Expand Up @@ -482,7 +482,7 @@ void Agent::scrapeOutput()
memcpy(bufLine, curLine, sizeof(CHAR_INFO) * w);
for (int col = w; col < MAX_CONSOLE_WIDTH; ++col) {
bufLine[col].Attributes = curLine[w - 1].Attributes;
bufLine[col].Char.AsciiChar = ' ';
bufLine[col].Char.UnicodeChar = L' ';
}
m_maxBufferedLine = std::max(m_maxBufferedLine, line);
sawModifiedLine = true;
Expand Down Expand Up @@ -521,7 +521,7 @@ void Agent::syncMarkerText(CHAR_INFO *output)
sprintf(str, "S*Y*N*C*%08x", m_syncCounter);
memset(output, 0, sizeof(CHAR_INFO) * SYNC_MARKER_LEN);
for (int i = 0; i < SYNC_MARKER_LEN; ++i) {
output[i].Char.AsciiChar = str[i];
output[i].Char.UnicodeChar = str[i];
output[i].Attributes = 7;
}
}
Expand All @@ -538,7 +538,7 @@ int Agent::findSyncMarker()
for (i = m_syncRow; i >= 0; --i) {
int j;
for (j = 0; j < SYNC_MARKER_LEN; ++j) {
if (column[i + j].Char.AsciiChar != marker[j].Char.AsciiChar)
if (column[i + j].Char.UnicodeChar != marker[j].Char.UnicodeChar)
break;
}
if (j == SYNC_MARKER_LEN)
Expand Down
4 changes: 2 additions & 2 deletions agent/Win32Console.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void Win32Console::read(const SmallRect &rect, CHAR_INFO *data)
{
// TODO: error handling
SmallRect tmp(rect);
if (!ReadConsoleOutput(m_conout, data, rect.size(), Coord(), &tmp)) {
if (!ReadConsoleOutputW(m_conout, data, rect.size(), Coord(), &tmp)) {
trace("ReadConsoleOutput failed [x:%d,y:%d,w:%d,h:%d]",
rect.Left, rect.Top, rect.width(), rect.height());
}
Expand All @@ -317,7 +317,7 @@ void Win32Console::write(const SmallRect &rect, const CHAR_INFO *data)
{
// TODO: error handling
SmallRect tmp(rect);
if (!WriteConsoleOutput(m_conout, data, rect.size(), Coord(), &tmp)) {
if (!WriteConsoleOutputW(m_conout, data, rect.size(), Coord(), &tmp)) {
trace("WriteConsoleOutput failed");
}
}
Expand Down

0 comments on commit 72557cb

Please sign in to comment.