Fix emission of combining characters following wide characters in transcript

At the moment, combining characters which follow an East Asian wide
character are not being stored in the same column as the characters they
modify.  Fix this by keeping track of the width of the last spacing mark
emitted and using this to place combining characters into the correct
column.

Signed-off-by: Jack Palevich <jackpal@google.com>
This commit is contained in:
Steven Luo 2012-03-21 03:00:46 -07:00 committed by Jack Palevich
parent 14c7cebbaf
commit c4b50ab98c

View File

@ -233,6 +233,12 @@ public class TerminalEmulator {
*/
private boolean mAboutToAutoWrap;
/**
* The width of the last emitted spacing character. Used to place
* combining characters into the correct column.
*/
private int mLastEmittedCharWidth = 0;
/**
* True if we just auto-wrapped and no character has been emitted on this
* line yet. Used to ensure combining characters following a character
@ -1430,9 +1436,9 @@ public class TerminalEmulator {
if (width == 0) {
// Combining character -- store along with character it modifies
if (mJustWrapped) {
mScreen.set(mColumns - 1, mCursorRow - 1, c, foreColor, backColor);
mScreen.set(mColumns - mLastEmittedCharWidth, mCursorRow - 1, c, foreColor, backColor);
} else {
mScreen.set(mCursorCol - 1, mCursorRow, c, foreColor, backColor);
mScreen.set(mCursorCol - mLastEmittedCharWidth, mCursorRow, c, foreColor, backColor);
}
} else {
mScreen.set(mCursorCol, mCursorRow, c, foreColor, backColor);
@ -1444,6 +1450,9 @@ public class TerminalEmulator {
}
mCursorCol = Math.min(mCursorCol + width, mColumns - 1);
if (width > 0) {
mLastEmittedCharWidth = width;
}
}
private void emit(int c) {